datagrid passing parameters problem

Discussion in 'ASP .Net' started by Laura K, Jan 11, 2005.

  1. Laura K

    Laura K Guest

    I have a datagrid with a hyperlink field. It passes a parameter but I need
    it to pass three. I need two of the parameters to be querystrings that have
    already been passed to the page but I have no idea how to add them the the
    hyperlink column.

    Here is the code to the hyperlink column

    <asp:HyperLinkColumn
    HeaderText="strProductName"
    Visible="True"
    DataTextField="strProductName"
    DataNavigateUrlField="intProductID"
    DataNavigateUrlFormatString="details.aspx?ProductID={0}"/>
    <asp:BoundColumn DataField="curPrice"
    HeaderText="curPrice"
    ReadOnly="true"
    Visible="True"/>

    Here is the code if it were to be outside the datagrid.

    <a href="details.aspx?prodID=<%# dsSubCategory.FieldValue("intProductID",
    Container) %>&strCssPath=<%= Request.QueryString("StrCSSPath")
    %>&strSubCategory=<%=
    server.UrlEncode(Request.QueryString("strSubCategory")) %>">

    I have taken care of the details.aspx?#
    dsSubCategory.FieldValue("intProductID", Container) %>

    but I do not know how to pass the existing parameters

    Any help appreciated.

    Thanks
    Laura K
     
    Laura K, Jan 11, 2005
    #1
    1. Advertising

  2. You will need to create a template column that contains an <a> element
    instead of a HyperLinkColumn. You then can build the QueryString from
    within the Template column.

    I have a code example at work. I will post the sample this evening.



    On Mon, 10 Jan 2005 16:47:58 -0800, "Laura K"
    <> wrote:

    >I have a datagrid with a hyperlink field. It passes a parameter but I need
    >it to pass three. I need two of the parameters to be querystrings that have
    >already been passed to the page but I have no idea how to add them the the
    >hyperlink column.
    >
    >Here is the code to the hyperlink column
    >
    > <asp:HyperLinkColumn
    > HeaderText="strProductName"
    > Visible="True"
    > DataTextField="strProductName"
    > DataNavigateUrlField="intProductID"
    > DataNavigateUrlFormatString="details.aspx?ProductID={0}"/>
    > <asp:BoundColumn DataField="curPrice"
    > HeaderText="curPrice"
    > ReadOnly="true"
    > Visible="True"/>
    >
    >Here is the code if it were to be outside the datagrid.
    >
    ><a href="details.aspx?prodID=<%# dsSubCategory.FieldValue("intProductID",
    >Container) %>&strCssPath=<%= Request.QueryString("StrCSSPath")
    >%>&strSubCategory=<%=
    >server.UrlEncode(Request.QueryString("strSubCategory")) %>">
    >
    >I have taken care of the details.aspx?#
    >dsSubCategory.FieldValue("intProductID", Container) %>
    >
    >but I do not know how to pass the existing parameters
    >
    >Any help appreciated.
    >
    >Thanks
    >Laura K
    >
    >


    Otis Mukinfus
    http://www.otismukinfus.com
     
    Otis Mukinfus, Jan 11, 2005
    #2
    1. Advertising

  3. Laura K

    Saravana Guest

    Check out this faq,
    http://www.extremeexperts.com/Net/faq/PassingMulitpleParameterinURLLink.aspx

    --
    Saravana
    http://dotnetjunkies.com/WebLog/saravana/
    www.ExtremeExperts.com


    "Laura K" <> wrote in message
    news:...
    > I have a datagrid with a hyperlink field. It passes a parameter but I

    need
    > it to pass three. I need two of the parameters to be querystrings that

    have
    > already been passed to the page but I have no idea how to add them the the
    > hyperlink column.
    >
    > Here is the code to the hyperlink column
    >
    > <asp:HyperLinkColumn
    > HeaderText="strProductName"
    > Visible="True"
    > DataTextField="strProductName"
    > DataNavigateUrlField="intProductID"
    > DataNavigateUrlFormatString="details.aspx?ProductID={0}"/>
    > <asp:BoundColumn DataField="curPrice"
    > HeaderText="curPrice"
    > ReadOnly="true"
    > Visible="True"/>
    >
    > Here is the code if it were to be outside the datagrid.
    >
    > <a href="details.aspx?prodID=<%# dsSubCategory.FieldValue("intProductID",
    > Container) %>&strCssPath=<%= Request.QueryString("StrCSSPath")
    > %>&strSubCategory=<%=
    > server.UrlEncode(Request.QueryString("strSubCategory")) %>">
    >
    > I have taken care of the details.aspx?#
    > dsSubCategory.FieldValue("intProductID", Container) %>
    >
    > but I do not know how to pass the existing parameters
    >
    > Any help appreciated.
    >
    > Thanks
    > Laura K
    >
    >
    >
     
    Saravana, Jan 11, 2005
    #3
  4. Here is the sample I promised you...

    <asp:TemplateColumn HeaderText="Supervisor">
    <ItemTemplate>
    <a runat="server"
    href='<%# "supervisordisplay.aspx" +
    "?supid=" + DataBinder.Eval(Container.DataItem, "supid") +
    "&fullsupname=" + DataBinder.Eval(Container.DataItem, "supname") +
    ", " + DataBinder.Eval(Container.DataItem, "supinit") %>'>
    <%# DataBinder.Eval(Container.DataItem, "supname") +
    ", " + DataBinder.Eval(Container.DataItem, "supinit") %>
    </a>
    </ItemTemplate>
    </asp:TemplateColumn>


    Otis Mukinfus
    http://www.otismukinfus.com
     
    Otis Mukinfus, Jan 11, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Nikhil Patel

    problem passing parameters

    Nikhil Patel, May 3, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    604
    Nikhil Patel
    May 3, 2004
  2. Jeff

    problem passing parameters

    Jeff, Oct 22, 2008, in forum: ASP .Net
    Replies:
    2
    Views:
    409
  3. Ramon F Herrera
    Replies:
    8
    Views:
    508
    Pascal J. Bourguignon
    Sep 13, 2009
  4. davidbe
    Replies:
    1
    Views:
    138
    davidbe
    Jan 16, 2006
  5. Sherm Pendley
    Replies:
    6
    Views:
    114
    Vikrant
    Jul 1, 2005
Loading...

Share This Page