How to send multiple URL fields in Http Header using asp.net datagrid

Discussion in 'ASP .Net Datagrid Control' started by Kamal Ahmed, Jun 22, 2005.

  1. Kamal Ahmed

    Kamal Ahmed Guest

    Hi All,

    I have a problem with Asp.Net Datagrid. I have two 2 databound fields in
    Asp.Net Datagrid "Code" & "Name". I want to send values of both columns by
    clicking on (Code) URL field.
    e.g. Values should be sent to Http header like this:
    /pagename.aspx?code=01&name=Christopher

    How is it possible ?

    TIA
     
    Kamal Ahmed, Jun 22, 2005
    #1
    1. Advertisements

  2. Kamal Ahmed

    Elton Wang Guest

    You can have a HyperLinkColumn in the datagrid. Then in
    datagrid_ItemDataBound event, you can assign url with query string for the
    HyperLink:

    if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == case
    ListItemType.AlternatingItem)
    {
    HyperLink link = (HyperLink)e.item.Cells[link_column_index].Controls[0];
    link.NavigateUrl = "/pagename.aspx?code=" +
    e.item.Cells[code_column_index].Text + "&name=" +
    e.item.Cells[name_column_index].Text;
    }


    HTH

    Elton Wang
     
    Elton Wang, Jun 22, 2005
    #2
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.