From: Mario on 25 May 2010 08:34 The row below: <asp:Label runat="server" ID="Label4" Text="<%# System.Math.Ceiling((double)(Container.TotalRowCount)/(double)Container.PageSize) %>" /> And it works fine, but I wonder, how to write similar code when I don't have code completion between <% %> tag ? Code above I've finished in .cs file, after I saw similar example, then I copied in a aspx file.
From: Alexey Smirnov on 25 May 2010 08:50 On May 25, 2:34 pm, "Mario" <mzu...(a)vup.hr> wrote: > The row below: > > <asp:Label runat="server" ID="Label4" Text="<%# > System.Math.Ceiling((double)(Container.TotalRowCount)/(double)Container.Pag eSize) > %>" /> > > And it works fine, but I wonder, how to write similar code when I don't have > code completion between <% %> tag ? Code above I've finished in .cs file, > after I saw similar example, then I copied in a aspx file. You can add your code between <script></script> tags in the asx page <script runat="server"> Sub Page_Load(sender As Object, e As EventArgs) Label4.Text = "Test" End Sub </script> For more information about Code Behind and Code Inline look here http://quickstarts.asp.net/QuickStartv20/aspnet/doc/pages/codebehind.aspx
From: Mario on 26 May 2010 02:02 "Alexey Smirnov" <alexey.smirnov(a)gmail.com> wrote in message news:dbf7f297-a215-4a66-8fbf-681d0ec13888(a)f14g2000vbn.googlegroups.com... On May 25, 2:34 pm, "Mario" <mzu...(a)vup.hr> wrote: > The row below: > > <asp:Label runat="server" ID="Label4" Text="<%# > System.Math.Ceiling((double)(Container.TotalRowCount)/(double)Container.Pag > eSize) > %>" /> > > And it works fine, but I wonder, how to write similar code when I don't > have > code completion between <% %> tag ? Code above I've finished in .cs file, > after I saw similar example, then I copied in a aspx file. You can add your code between <script></script> tags in the asx page <script runat="server"> Sub Page_Load(sender As Object, e As EventArgs) Label4.Text = "Test" End Sub </script> For more information about Code Behind and Code Inline look here http://quickstarts.asp.net/QuickStartv20/aspnet/doc/pages/codebehind.aspx I tried wrote script above the <head> tag: <script runat="server"> System.Math. </script> And I had code completion for System. Math but further Math methods are still unrichable for code completion, so I must look at help to find what method I need, while in Default.aspx.cs I have completion for every method or variable of some class. 99% of code I write in .cs file, but sometimes I only need some small part of a code and then I need to search the whole System.Math help. I just check if my VS2008 is setup correctly.
From: Alexey Smirnov on 26 May 2010 04:53 On May 26, 8:02 am, "Mario" <mzu...(a)vup.hr> wrote: > I tried wrote script above the <head> tag: > <script runat="server"> > > System.Math. > > </script> > > And I had code completion for System. Math but further Math methods are > still unrichable for code completion, so I must look at help to find what > method I need, while in Default.aspx.cs I have completion for every method > or variable of some class. 99% of code I write in .cs file, but sometimes I > only need some small part of a code and then I need to search the whole > System.Math help. I just check if my VS2008 is setup correctly. Intellisense will not work if code block is incorrect. In your example above, you missed the body of a function where you would like to execute your code with a reference to System.Math. For VB example please refer to my last post. C# version should look like <script runat="server"> protected void Page_Load(object sender, EventArgs e) { Label1.Text = System.Math.Sin(1).ToString(); } </script> Hope this helps
|
Pages: 1 Prev: Application Hosting Next: What's wrong with this file write code |