clear text box (txtSearch) and reload datagrid

5 views
Skip to first unread message

BlueVista

unread,
Feb 19, 2009, 3:46:09 PM2/19/09
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
Hi,

I read through this blog and it's perfectly working. I am truly
thankful.
http://www.c-sharpcorner.com/Blogs/BlogDetail.aspx?BlogId=825

Now, I put a button called btnClear so clear the textbox (where user
input some search text) and reload the grid just like it did when
first time the page loaded. I used following code but not working. I
dont any error. It still shows the searched items not the full grid. I
tried to clear the txtSearch text using this piece of code but it does
not clear the text from the searc text box. (txtSearch.Text =
string.Empty;)

protected void btnShowAll_Click(object sender, EventArgs e)
{
SqlDataSource1.FilterExpression = null;
Session["MyFilter"] = null;
}

Thanks

Tanvir Faraj

unread,
Feb 20, 2009, 8:50:03 AM2/20/09
to DotNetDe...@googlegroups.com
Hi, try the following:

SqlDataSource1.FilterExpression = "";


Thanks
TFR.

BlueVista

unread,
Feb 20, 2009, 11:59:18 AM2/20/09
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
Actually my code is perfectly fine. All I had to do is add another
button from Standard Toolbar and add the code. and Now it's working.
(before when i clicked on btnShowAll it would fire up btnSearch. I
just got to know about this when I turned on the breakpoint and
noticed that showall click event never fired up. instead btnSearch
fires up. I have no idea why)
Reply all
Reply to author
Forward
0 new messages