• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 5003
  • Last Modified:

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.
0
kahvedzic
Asked:
kahvedzic
  • 5
  • 2
  • 2
  • +2
1 Solution
 
Reza RadCommented:
set AutoPostBack property of gridview to false

0
 
kahvedzicAuthor Commented:
I have no autopostback property for GridView
0
 
HainKurtSr. System AnalystCommented:
what does select button do?
0
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 
fsouzabrasilCommented:
On load page add

if (!IsPostBack)
{
 //Grid load
}
0
 
kahvedzicAuthor Commented:
@HainKurt:
it select gridview row
@fsouzabrasil:
vb please
0
 
HainKurtSr. System AnalystCommented:
0
 
kahvedzicAuthor Commented:
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.
0
 
chandrashekharnathCommented:
It is not clear from your explanation that which control you are using for selection. but lets assume if you have a checkbox control then you can insert "onClientClick" attribute in design of the gridview and could write something like below:

OnClientClick = "javascript:return false;"

this additional attribute will prevent a page from refreshing itself. as we know the server controls by default create a postback to the page, the client side script will prevent it from doing so.

I hope this helps...
0
 
kahvedzicAuthor Commented:
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?
0
 
chandrashekharnathCommented:
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...
0
 
kahvedzicAuthor Commented:
I create select button with OnClientClick = "javascript:return false;" and now works fine.
Thanks.

0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

  • 5
  • 2
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now