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

K

Kamal Ahmed

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
 
E

Elton Wang

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
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top