Click here to Skip to main content
15,920,438 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi all,,

i want to search item from textbox1 and display data in gridview and add hyperlink in gridview to pass to item page...

this is my code

SqlDataAdapter db = new SqlDataAdapter("select itemno ,itemname,category from items_tbl where itemname like '%" + TextBox1.Text + "%' ", con);
      DataTable dt = new DataTable();
      db.Fill(dt);
      GridView1.DataSource = dt;
      GridView1.DataBind();


this code run perfect but i want to add hyperlink to pass to item page

thanks
Posted
Updated 18-Jul-11 20:31pm
v2
Comments
walterhevedeich 19-Jul-11 2:07am    
Please update your title, it doesn't describe your problem. From what I understand, your problem is how to add hyperlink to the gridview, not searching data on the database.
shms_rony 19-Jul-11 2:31am    
thanks

1 solution

try this

<asp:TemplateField>
<ItemTemplate><asp:hyperlink id="hlk1" runat="server" navigateurl="defalt2.aspx" text='"#<%Eval ("sno") %>"'></asp:hyperlink></ItemTemplate>
</asp:TemplateField>
 
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