How to avoid postback wheh click ImageButton to show/hide Gridview rows
-
Hi, all, I use Asp.net 2.0. I create a ImageButton in a gridview row with category ID, when click it I will call function to show or hide all the rows with the same category ID, everything works fine. But the problem is that every time the button is click, the postback is called, how can I stop that? or have any better way to achieve my purpose, Thanks a lot.
What you can do, you can use Template Field to place ImageButton With in a AJAX Update Panel.
Cheers ! Abhijit Jana | MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you.
-
Hi, all, I use Asp.net 2.0. I create a ImageButton in a gridview row with category ID, when click it I will call function to show or hide all the rows with the same category ID, everything works fine. But the problem is that every time the button is click, the postback is called, how can I stop that? or have any better way to achieve my purpose, Thanks a lot.
use Ajax update panel and place your Image button in it.. :)
-
Are you calling a javascript function to show hide the rows, if yyes just return fasle from that javascript function
Cheers!! Brij Check my latest Article :Exploring ASP.NET Validators
Hi, Brij. Thank you for your reply. When click button I call a function in .cs file. Can I avlid postback if use this way? I also search internet and try to user javascript to solve it, but failed. To access gridview row information like the following, I put it in block. But this doesn't work, get error "Object Required" in line: rows = document.getElementById(gridName).rows; also ask a silly question, since the javascript block is inside <head runat = "server"> </head>, it will executed in server side or client side? Thanks</x-turndown>
-
What you can do, you can use Template Field to place ImageButton With in a AJAX Update Panel.
Cheers ! Abhijit Jana | MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you.
-
Hi, Brij. Thank you for your reply. When click button I call a function in .cs file. Can I avlid postback if use this way? I also search internet and try to user javascript to solve it, but failed. To access gridview row information like the following, I put it in block. But this doesn't work, get error "Object Required" in line: rows = document.getElementById(gridName).rows; also ask a silly question, since the javascript block is inside <head runat = "server"> </head>, it will executed in server side or client side? Thanks</x-turndown>
Itll be better if you use updatepanel then your posstback wont occur only your grid will be updated. And how to use updatepanel Have a look
Cheers!! Brij Check my latest Article :Exploring ASP.NET Validators
-
Itll be better if you use updatepanel then your posstback wont occur only your grid will be updated. And how to use updatepanel Have a look
Cheers!! Brij Check my latest Article :Exploring ASP.NET Validators
-
Hi, all, I use Asp.net 2.0. I create a ImageButton in a gridview row with category ID, when click it I will call function to show or hide all the rows with the same category ID, everything works fine. But the problem is that every time the button is click, the postback is called, how can I stop that? or have any better way to achieve my purpose, Thanks a lot.
-
Hi, Brij, I got an error "Unknown server tag 'asp:ScriptManager'.", what should I do to use it?
If you are visual studio 2005, then you need to install Ajaxextentions, Download from here Then a new template would be added in vs2005, that is ASP.NETAjaxEnabledWebsite create website of that template and it;ll work. In vs2008 or later it is not required.
Cheers!! Brij Check my latest Article :Exploring ASP.NET Validators
-
If you are visual studio 2005, then you need to install Ajaxextentions, Download from here Then a new template would be added in vs2005, that is ASP.NETAjaxEnabledWebsite create website of that template and it;ll work. In vs2008 or later it is not required.
Cheers!! Brij Check my latest Article :Exploring ASP.NET Validators
-
Hi, all, I use Asp.net 2.0. I create a ImageButton in a gridview row with category ID, when click it I will call function to show or hide all the rows with the same category ID, everything works fine. But the problem is that every time the button is click, the postback is called, how can I stop that? or have any better way to achieve my purpose, Thanks a lot.
Hi, As far i know, You want to show the Master/Detail Grid view. ie, if u click the [more] button (imagebutton), u want to show the detailed/ sub grid. if i caught you correct, let me know, so that i can give u a gud solution. http://www.progtalk.com/viewarticle.aspx?articleid=54 http://www.giswiz.com/nested\_gridview\_dropdown/Default.aspx cheers, Sam
modified on Thursday, April 22, 2010 3:45 AM
-
Hi, As far i know, You want to show the Master/Detail Grid view. ie, if u click the [more] button (imagebutton), u want to show the detailed/ sub grid. if i caught you correct, let me know, so that i can give u a gud solution. http://www.progtalk.com/viewarticle.aspx?articleid=54 http://www.giswiz.com/nested\_gridview\_dropdown/Default.aspx cheers, Sam
modified on Thursday, April 22, 2010 3:45 AM
-
Sam, Yes, you are right. I alreay solve my question by using javascript to show/hide group rows in gridview. I have another question, why the grid always has one more empty row as last row of the gridview grid, how can I avoid it? Thanks!