Click here to Skip to main content
15,893,486 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
okk first of all i know about qury string overview is that query string is use to post some value of one page to another page....okk its fine
now i m creating one CMS website now in that i have one menu link named PRODUCTS now click on this it will show all the products in perticular table format ...now my point is when click of perticular image of this product it will post to another page and it will show large image with technical description of this product so in URL it is shown like http:\\www.xyz.com\Products.aspx?Id=1234 now i want hint of coding for this things..how i can generate Id in url it willl come from database value ?? please give me some hints .....thank u
Posted
Updated 21-Feb-13 8:56am
v2
Comments
Sergey Alexandrovich Kryukov 21-Feb-13 14:42pm    
C and ASP.NET? How is it?
—SA
pandya purvang 21-Feb-13 14:48pm    
sorry its c# and asp.net
Sergey Alexandrovich Kryukov 21-Feb-13 14:55pm    
Can you see "Improve question" on top? :-)
—SA
pandya purvang 21-Feb-13 14:57pm    
yes sir ...but if any one give me some hint then it is also very helpfull to me ..
ZurdoDev 21-Feb-13 15:04pm    
You just need to read the data from the database and put it onto the querystring. Maybe if you posted some relevant code we can be more specific.

I suggest you to start here: ASP.NET Tutorial[^]
 
Share this answer
 
Hi, Use datalist to show your product images, datalist have property that 'DataKeyField' set this property is equal to your ProductId, and use ItemCommand Event to go to the Product details page.
 
Share this answer
 
Its probably best to use UrlEncode[^] with your query string. This encodes the string during transmissions and protects from injection attacks.
 
Share this answer
 
Dear Pandya
It seems that you have problem in to fetch the data from database and forward it to the next page with the use of Query String
So for that purpose firstly bind your data in ListView(I am taking an example with the help of Eval)
Suppose From your requirement There is and product id(From DB) Which you want to take with your page
So
ASP.NET
<asp:listview id="list" runat="server" groupitemcount="1" xmlns:asp="#unknown">
        EnableModelValidation="True">
    <emptydatatemplate>
        No Data Is Available Right Now
    </emptydatatemplate>
    <layouttemplate>
        <table>
            <tr runat="server" id="groupPlaceholder" />
        </table>
    </layouttemplate>
    <grouptemplate>
        <tr>
            <td runat="server" id="itemPlaceholder" />
        </tr>
    </grouptemplate>
    <itemtemplate>
       <tr>
            <td colspan="2">
                 <a href="Preview.aspx?articleid=<%# Eval(" product_id=") %>">
           <asp:label id="title" runat="server" text="<%# Eval("Title") %>" />
                     </a>
                </td>
           </tr>
           <tr>
           <td colspan="2">
          
    </td></tr></itemtemplate>
</asp:listview>

Do not forget to bind this list view in code behind
Hope You got the solution
 
Share this answer
 

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