Click here to Skip to main content
15,906,645 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Can Anyone giv code for if i click a button of datalist it will pass querystring to another page.
Posted

Bind your querystring value to CommandArgument property of Button control. Find the value inside DataList1_ItemCommand event of DataList Control, and redirect the page from here.


C#
protected void DataList1_ItemCommand(object source,
    DataListCommandEventArgs e)
{
  Button btn = source as Button; 
  if (btn != null && convert.toString(btn.CommandArgument) != string.empty)
   {
       response.redirect("Defaut2.aspx?UserId="+btn.CommandArgument.toString())
   }
}



follow the link to learn more..

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.datalist.itemcommand(v=VS.100).aspx


Anil Pandya :)
 
Share this answer
 
v2
 
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