We need you!

We're working hard on the next version of Developer Fusion. Let us know what you think we should be up to!

Members

Technology Zones

Articles

Hosted By

MaximumASP

Info

Hypelink field in gridview

Last post 03-31-2008 1:45 AM by girlkulit. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 03-28-2008 5:22 AM

    Hypelink field in gridview

    hi,

    I  have  3 tables in my database  1.Prouct(ProductId,Productname)

                                                    2.Problems(ProductId,PoblemID,ProblemDesc)

                                                    3. Solutions(ProblemId,Solutiondesc)

     

    Now in my first page I have to display all the Productnames in a gridview with hyperlink to each product name.

    On clicking  th productname i should pass the product id of the product to second page.

    In second page i should display the problems relateds to product id 1 and so.
    In the gridview i Used Hyperlinkfield.Now how do i Pass the product id  of the product to second page during the navigation?

     
     

    • Post Points: 10
  • 03-28-2008 8:10 AM In reply to

    • girlkulit
    • Top 500 Contributor
    • Joined on 01-17-2008
    • Philippines
    • Member
    • Points 480

    Re: Hypelink field in gridview

    Assuming you already have your datatable binded to your gridview, instead of using hyperlink, try this...

    <asp:TemplateField HeaderText="Product Id">
        <ItemTemplate>
     <a href="page2.aspx?prod_id=<%# DataBinder.Eval(Container.DataItem, "ProductId") %>">
         <asp:Label ID="lblProductId" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "ProductId") %>'></asp:Label></a></ItemTemplate>
    </asp:TemplateField>

    Here, i'm passing the product id through the querystring. in your page 2, just add:

    String strProdId = Request.QueryString["prod_id"].ToString()

    Hmm, don't know if this can help... Please tell me so, if it did. Even if it didn't, just let me know.. If I misunderstood, please clarify, ü
    i couldn't sleep, and wouldn't sleep, [love] asp.net and c# came and told me i shouldn't sleep, bewitched bothered and bewildered, am i
    • Post Points: 10
  • 03-28-2008 10:09 AM In reply to

    Re: Hypelink field in gridview

     hi,

     It worked for me.thanks a lot.


     

    • Post Points: 10
  • 03-31-2008 1:45 AM In reply to

    • girlkulit
    • Top 500 Contributor
    • Joined on 01-17-2008
    • Philippines
    • Member
    • Points 480

    Re: Hypelink field in gridview

    ur welcome, ü

    i couldn't sleep, and wouldn't sleep, [love] asp.net and c# came and told me i shouldn't sleep, bewitched bothered and bewildered, am i
    • Post Points: 5
Page 1 of 1 (4 items)