Friday, May 27, 2011

use of dynamic hyperlink to gridview

&ltItemTemplate&gt
&lta href='QUESTIONANSWER.aspx?id=<%#DataBinder.Eval(Container.DataItem,"queryid") %&gt'&gt
&lt%#DataBinder.Eval(Container.DataItem,"question") %&gt&lt/a&gt
&lt/ItemTemplate&gt
public void grigfill()
{
try
{
SqlConnection con2 = new SqlConnection(ConfigurationManager.AppSettings["Forumcon"].ToString().Trim());
SqlDataAdapter da = new SqlDataAdapter("select Top 10 queryid,Name ,question from query", con2);
DataSet ds = new DataSet();
da.Fill(ds);
gridqueans.DataSource = ds;
gridqueans.DataBind();
}
catch (Exception Ex)
{
Response.Write("Error Occured");
}
}

No comments:

Post a Comment