Sunday, July 12, 2009

In asp.net 2.0 how to add C# code in the design screen?

im a new asp.net user and i wonder if i can put some c# code along with the design


eg. %26lt;asp:textbox "c# code" /%26gt;


is it any possible?

In asp.net 2.0 how to add C# code in the design screen?
NO, not in the way you have it provided





You can use inline code to write C# in the aspx page (with declarative code) though.Ex:


%26lt;script runat="server" type="text/C#"%26gt;


//write your C# here


%26lt;/script%26gt;





You can also write code in classic ASP (or like PHP) style as in:


%26lt;% if (ActiveStudents.Count != 0) {%%26gt;


%26lt;a href="Students.aspx?id=%26lt;%=StudentId%%26gt; Student %26lt;/a%26gt;


%26lt;% } %%26gt;





I prefer to keep my declarative pages for markup and write my logic in a seperate code behind file.
Reply:Computer Tutorials, Interview Question And Answer


http://freshbloger.com/


No comments:

Post a Comment