Hi, I have been using asp.net for a short period of time now and really enjoy the functionality offered by visual studio. However I see there is no automated way of generating a search of a datagrid. What i want to do is simple take the string from a textbot when the search button is pressed and either highlight the matches in the datagrid or to regenerate the datagrid displaying the matches. I want to search only on column which will be the resource name. I have looked throug many threads and there have been a few solutions but they all seem to be in VB.NET. As I have only ever used C# I am terrified by this code! If anyone would be so kind to either link me to a page with C# code for searching a datagrid or to perhaps post some code of their own it would be greatly appreciated.
Thanks
.NetIdiot
.netidiot
-2
Newbie Poster
Recommended Answers
Jump to Postadd below code in aspx.cs
public partial class _Default : System.Web.UI.Page { DataGrid dg = new DataGrid(); protected void Page_Load(object sender, EventArgs e) { dg.DataSource = SqlDataSource1; dg.DataBind(); Panel1.Controls.Add(dg); } protected void Button1_Click(object sender, EventArgs e) { foreach (DataGridItem dgi in dg.Items) { if …
Jump to PostIn the code I pasted above, the DataGrid was added dynamically, and therefore need to be put either on a Panel or directly on the page.
DataGrid dg = new DataGrid(); protected void Page_Load(object sender, EventArgs e) { dg.DataSource = SqlDataSource1; dg.DataBind(); //Here you add to Panel1 …
All 6 Replies
chithrasujith
0
Newbie Poster
.netidiot
-2
Newbie Poster
.netidiot
-2
Newbie Poster
.netidiot
-2
Newbie Poster
chithrasujith
0
Newbie Poster
kvprajapati
1,826
Posting Genius
Team Colleague
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.