Click here to Skip to main content
15,894,343 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, my problem is I don't know how use the formView QueryString in code behind.
i want add to table by dataset, with formview and sqldatasource everything is OK, but with dataset in code behind I don't know what should i do for the "product_id".

C#
<asp:QueryStringParameter Name="Product_id" QueryStringField="product_id" Type="Int32" />


Thanks all.
Posted
Updated 30-Jul-15 22:50pm
v2

1 solution

Write this in code behind to get the value of query string field.

C#
string prodId = Request.QueryString["product_id"];
 
Share this answer
 
Comments
Afzaal Ahmad Zeeshan 31-Jul-15 4:49am    
In ASP.NET, convention is to always use var instead of data type. Anyways, 4ed for your answer. :-)
F-ES Sitecore 31-Jul-15 5:06am    
No, that's just resharper telling you (wrongly) that you should use var :) Looking at his code I know prodId is a string, if it was "var" then how do I know what is being returned just by looking at it?
Afzaal Ahmad Zeeshan 31-Jul-15 5:07am    
True, but everything in the query string is a string. You don't expect a file to be appended in the URL? ;-) Would you? :laugh:
F-ES Sitecore 31-Jul-15 5:45am    
That's only because you know what QueryString returns from experience. Someone new to the code won't know just from looking at your code. var is merely a compiler mnemonic that gets replaced with the proper variable name, all you're doing is adding confusion by using var.
Member 11829564 31-Jul-15 5:14am    
Thanks guys :X

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900