Link to home
Start Free TrialLog in
Avatar of kahvedzic
kahvedzicFlag for Bosnia and Herzegovina

asked on

how to disable gridview refresh on select row event

How can I disable refresh of gridview when clicking Select button.
Example:
Gridview loads on page load event, in first column I have select button and when I want to select first row, after clicking on select gridview is refreshing and changing color of that row. Problem is if I have a new row in Grid after clicking on button select it will select that new first row except one that I select.
What I want is to disable a refresh of gridview on button select click so I can select row that I want and refresh gridview manualy.
Avatar of Reza Rad
Reza Rad
Flag of New Zealand image

set AutoPostBack property of gridview to false

Avatar of kahvedzic

ASKER

I have no autopostback property for GridView
what does select button do?
On load page add

if (!IsPostBack)
{
 //Grid load
}
@HainKurt:
it select gridview row
@fsouzabrasil:
vb please
this tutorial is for selecting gridview row without select button, I need to have select button in gridview. When I click on select button I dont want any new rows created in gridview until I manualy refresh page.
ASKER CERTIFIED SOLUTION
Avatar of chandrashekharnath
chandrashekharnath

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I select row with this
<Columns>
<asp:CommandField ButtonType="Image" ShowSelectButton="True" SelectImageUrl="~/Images/check.gif" > 
<ItemStyle HorizontalAlign="Center" />
</asp:CommandField>
</Columns>
How to add OnClientClick for this button?
Avatar of chandrashekharnath
chandrashekharnath

No need to add OnClientClick event.
If possible for you, please create CommandField of type link and not image. and if you need to have image there, you can always place that with the help of image tag(html).
I hope this helps. let me know...
I create select button with OnClientClick = "javascript:return false;" and now works fine.
Thanks.