Hello everyone, I was wondering if it is possible to take an int from C# and then use that value in ASP.NET. For example I have a SqlDataSource on my page and I want to set an insert parameter as a value that is used and updated through C# code.
Also can anyone recommend a good book for ASP.NET 2.0? I know there are many out there but before I purchase one some opinions would be nice.
Thank you,
Ryan
RakrusPosted Nov 6, 2007, 11:55 PM
Hi
Check this link it may helps's you
http://peterkellner.net/2006/09/18/expressionbuilderidentity/
Ryan TurneyPosted Nov 6, 2007, 5:03 PM
I'm sorry I tried what you said but it doesn't work. I am putting this as a DefaultValue in my DetailsView this code is as follows:
<
InsertParameters><asp:Parameter Name="QuestionNumber" Type="Int32" DefaultValue="<% currentQuestion %>" />
InsertParameters>
I have also tried adding a equals sign (=) in front of currentQuestion but it still does not work. I am getting no errors or anything like that, any ideas?
Thanks,
Ryan
RakrusPosted Nov 6, 2007, 5:54 AM
Hi,
You can declare the variable as public in c#(i.e public int x=0)
Acess it in Asp.net i.e in aspx file by using <% %> block.
var ServerVal='<% =x%>'
The better book for Asp.Net 2.0 are Amazon books