posted by 네코냥이 2015. 1. 8. 11:39


Posting across pages.pdf


1. 이전페이지 등록

2. 

<asp:Button runat="server" PostBackUrl="~/xxxx/yyyy.aspx" ID="btnCross"

                    CssClass="hc" />

posted by 네코냥이 2014. 12. 12. 10:17


정규식.pdf


'.NET > C#' 카테고리의 다른 글

C# Linq IEnumerable to XML  (840) 2017.05.17
C# console application keep alive. 콘솔 꺼짐 방지  (146) 2016.04.08
Add radio button list items programmatically in asp.net  (287) 2014.12.09
Static Constructor in C  (0) 2014.09.06
실버라이트 개요  (0) 2014.05.13
posted by 네코냥이 2014. 12. 9. 16:03

I have a radio button list whose items I need to add on Page_Load

aspx code

<asp:radioButtonList ID="radio1" runat="server" RepeatLayout="Flow" RepeatDirection="Horizontal">
</asp:radioButtonList>

code behind

protected void Page_Load(object sender, EventArgs e)
{
    RadioButtonList radioList = (RadioButtonList)Page.FindControl("radio1");
    radioList.Items.Add(new ListItem("Apple", "1"));
}

After the control reaches radioList.Items.Add

I keep getting the Object reference not set to instance of an object error

What am I doing wrong?

share|improve this question
2 
Is radio1 inside another asp.net control like a repeater or something like that? –  Claudio Redi Aug 12 '13 at 15:10
3 
You can access the radioButtonList from code behind just calling the ID radio1.Items.Add(new ListItem("Apple", "1")); –  Fals Aug 12 '13 at 15:11 
   
If its on same page why dont you directly write radio1.Items.Add? If not please edit your question. –  KuzgunAug 12 '13 at 15:12
   
@Claudio Redi: It is embedded inside a series of <div> elements –  user544079 Aug 12 '13 at 15:13
   
Yes, I can access it now using radio1.Items.Add –  user544079 Aug 12 '13 at 15:14

You don't need to to do a FindCOntrol. As you used the runat="server" attributes, just get the reference of your RadioList via its name "radio1"

protected void Page_Load(object sender, EventArgs e)
{
    radio1.Items.Add(new ListItem("Apple", "1"));
}
share|improve this answe


'.NET > C#' 카테고리의 다른 글

C# console application keep alive. 콘솔 꺼짐 방지  (146) 2016.04.08
[Visual Studio] 검색 정규식  (0) 2014.12.12
Static Constructor in C  (0) 2014.09.06
실버라이트 개요  (0) 2014.05.13
[C#] PCL 라이브러리 (Portable Class Library)  (0) 2014.05.13
posted by 네코냥이 2014. 11. 6. 12:04

Do I need to SubmitChanges after executing a stored procedure with Linq-To-Sql?


답변1


No you don't. The code will work. Submit changes is only concerned with modified LINQ to SQL objects and not stored procs.


답변2


If you update records via stored proc, your loaded (and tracked) objects may become stale. If you call SubmitChanges with stale objects, you'll get concurrency exceptions. You can refresh a stale object using the Refresh method on DataContext.

posted by 네코냥이 2014. 10. 25. 09:53


다수의 모듈 사용

방법 1

각각의 모듈들을 불러온다.

후에 다음과 같은 방법으로 통합


예제1

var app = angular.module('app', ['phonecat', 'computer']);


예제2

// in main app.js file
var app = angular.module('myapp', 
          ['myapp.routers', 'myapp.directives', 'myapp.filters']);

// in filters.js
angular.module('myapp.filters', []).filter(....)

// in routers.js
angular.module('myapp.routers', []).router(....)

// in directives.js
angular.module('myapp.directives', []).directive(....)



방법 2


ng-app 대신 ng-module 사용.


<!DOCTYPE html>
<html>
    <head>
        <script src="angular.js"></script>
        <script src="angular.ng-modules.js"></script>
        <script>
          var moduleA = angular.module("MyModuleA", []);
          moduleA.controller("MyControllerA", function($scope) {
              $scope.name = "Bob A";
          });

          var moduleB = angular.module("MyModuleB", []);
          moduleB.controller("MyControllerB", function($scope) {
              $scope.name = "Steve B";
          });
        </script>
    </head>
    <body>
        <div ng-modules="MyModuleA, MyModuleB">
            <h1>Module A, B</h1>
            <div ng-controller="MyControllerA">
                {{name}}
            </div>
            <div ng-controller="MyControllerB">
                {{name}}
            </div>
        </div>

        <div ng-module="MyModuleB">
            <h1>Just Module B</h1>
            <div ng-controller="MyControllerB">
                {{name}}
            </div>
        </div>
    </body>
</html>


방법3. 기존 모듈에 컨트롤러를 추가


처음 모듈 선언.

var app = angular.module('ModuleName', []);


아래와 같은 방식으로 선언된 모듈 불러오기.

var app = angular.module('ModuleName');



방법4. 모듈의 통합


... 자료 찾는중.

posted by 네코냥이 2014. 10. 4. 12:36



 

 Controller

ApiController 

데이터 제공 

뷰 제공 

Y


또 라우팅을 다루는 클래스와 파일조차 구분되어있다.


Difference between ApiController and Controller in ASP.pdf


posted by 네코냥이 2014. 9. 25. 10:15

[angular] $broadcast, $emit, $on AngularJS 2014/09/12 17:26


출처: http://blog.naver.com/suy6107/220119971824


$broadcast

==> 부모 컨트롤러에서 자식 컨트롤러로 이벤트를 방송

$emit

==> 자식 컨트롤러에서 부모 컨트롤러로 이벤트 방송

$on

==> 방송한 이벤트를 받는다.

<부모>

$scope.$broadcast("parentToChildEvent", args); //자식에게 방송

<자식>

$scope.$on("parentToChildEvent", function(event, args) {

//이벤트 처리

});

<자식>

$scope.$emit("childToParentEvent", args); //부모에게 방송

<부모>

$scope.$on("childToParentEvent", function(event, args) {

//이벤트 처리

});

posted by 네코냥이 2014. 9. 6. 11:47


Static Constructor in C#.pdf


'.NET > C#' 카테고리의 다른 글

[Visual Studio] 검색 정규식  (0) 2014.12.12
Add radio button list items programmatically in asp.net  (287) 2014.12.09
실버라이트 개요  (0) 2014.05.13
[C#] PCL 라이브러리 (Portable Class Library)  (0) 2014.05.13
C# 바코드 라이브러리  (0) 2014.05.13
posted by 네코냥이 2014. 6. 19. 17:06


OnInit called but Page_Load not called on Postback _ The Official Forums for Microsoft ASP.pdf


왜 나는 안불르고 얘만 불러?

posted by 네코냥이 2014. 5. 29. 10:40

STATISTICS_NORECOMPUTE – When would anyone want to use it?

Question: Recently I noticed an option with CREATE/ALTER INDEX called STATISTICS_NORECOMPUTE? I'm not sure I understand this option or why you'd ever want to use it? Can you explain?

Answer: In general, I don't recommend this option. But, before I get to why - let me clarify what the option does. I've heard a few folks say that it stops SQL Server from updating the statistics at the time of a rebuild; that is NOT what it does. Statistics are ALWAYS updated at the time of a REBUILD; this cannot be turned off (nor would you want to).

Instead, STATISTICS_NORECOMPUTE stops the database-wide auto-updating (auto update statistics) from updating the specific statistics for an index (or column-level statistic) that was created (or rebuilt) with this option turned on. NOTE: STATISTICS_RECOMPUTE only works when creating or rebuilding an index. If you want to stop the auto-updating of a column-level statistic you use NORECOMPUTE when creating that particular statistic.

The more difficult question is if/when this would make sense to turn off – for either an index or a column-level statistic. And, yes, there are some cases where this can be appropriate.

Related: Making the Most of Automatic Statistics Updating

The case where it makes sense to be turned off is for tables that are large in size and have very skewed data distribution. For example, the ratio of line items per sale might be very evenly distributed between 1 and 3 items with an average of 2.1. Evenly distributed data tends to be easier to represent in a histogram (one of the pieces of information maintained in a statistic in SQL Server). However, sales per customer orsales per product might be much more uneven (and therefore skewed). And, when data distribution is skewed then then statistics are potentially less accurate in a histogram. This is further exacerbated by the process that SQL Server may choose of sampling your data. SQL Server will choose to sample your data (rather than reading every row) when the data they have to scan (ideally, an index but sometimes the table itself) is over 2,000 pages in size.

It’s further complicated because there are statistics on indexes as well as column-level statistics. So, I thought I’d put together a quick table to help you understand the combinations:

Statistics

Creation

Rebuild

Reorganize

Updating

Column-level

Can use sampling

n/a

n/a

Can use sampling

Index

FULLSCAN

FULLSCAN

Not updated

Can use sampling

When would you know it’s a problem? 
If you run a query and you evaluate the estimated rows vs. the actual rows and the estimate seems significantly different from the actual, then you might have a statistics problem. If you update statistics with the following code:

UPDATE STATISTICS tablename indexname (or statisticsname)

Then, try the query again. If this solved the problem, then you know that you’re not updating statistics enough. If it does not solve the problem then try updating the statistics will a fullscan:

UPDATE STATISTICS tablename indexname WITH FULLSCAN

If the estimate and actuals are more accurate (and typically result in better plans) then you might want to turn off the auto-updating of the statistic and solely control this particular statistics update with a job that updates the statistic with a full scan. The positive is that your statistics are likely to be more accurate and then your plans will be as well. The negative is that updating a statistic with a full scan can be a more costly maintenance operation. And, you have to be especially careful that your automated process doesn’t get removed or deleted leaving this statistic to never get auto-updated again. 

In summary, I don’t often recommend STATISTICS_NORECOMPUTE on indexes (or NORECOMPUTE on statistics) but there are cases when you might be able to better control the updating of statistics as well as allow for a FULLSCAN. In these cases (and when you’re certain that your automated routines will not be interrupted/deleted/modified), then using this option can be beneficial!

Related: Assessing File and Filegroup Metadata


'.NET > MS-SQL' 카테고리의 다른 글

[MS-SQL] 컬럼명 제약조건 추가하기  (0) 2014.01.06
SET ARITHABORT(Transact-SQL)  (0) 2014.01.02
SQL Server - Return value after INSERT  (0) 2013.12.30
SQL Server Stored Procedure capture return value in T-SQL  (0) 2013.12.30
인덱스 유형  (0) 2013.12.26