I have a java script variable and I want to use it into my sqldatasourse how can I do this. Here is my java script code
var div = document.getElementById('main_content').offsetHeight;
var length = Mah.round(div / 400);
And I want to use variable length here in select command
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:qbuyConnectionString1 %>"
SelectCommand="SELECT TOP variable * FROM [advertisement] WHERE ([enable] = @enable) ORDER BY NEWID()">
<SelectParameters><asp:Parameter DefaultValue="1" Name="enable" Type="Int32" /></SelectParameters>
</asp:SqlDataSource>
The easiest solution based on how you are trying to do this is a combination of some of the aforementioned suggestions.
Step 1:
Step 2:
Step 3: