Reputation: 468
I have the following div:
<div id="5" style=" display:none; " >
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:schoolConnectionString %>"
SelectCommand="SELECT * FROM [class] where classid=4 "></asp:SqlDataSource>
</div>
As you can see i am giving the classid = 4 manually by myself in the where condition.What I want is to give it dynamically according to to click made. What i am trying to do here is declare a variable inside div that will be assigned the value as per the click on the link and assign that variable to classid as classid=myvariable.
So my question is:
1.How to declare a variable inside div in asp.net?
2.How to assign classid=variable?
Upvotes: 0
Views: 467
Reputation: 2530
See the following article for an example of how this should be done
http://msdn.microsoft.com/en-us/library/vstudio/z72eefad(v=vs.100).aspx
You're code could be written something like this
SELECT * FROM [class] where classid=@classId
Then declare the parameter using
<SelectParameters>
<asp:Parameter Name="classid" Type="Int32" DefaultValue="0" />
</SelectParameters>
Upvotes: 1