How can I raise a client side event after PageIndexChanged? Actually, the requirement is that I have some hidden fields whose value I need to clear after grids PageIndexChanged event is done on server side.
Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.
Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.
Hi Anurag,
To update hidden field values using client-side methods, handle the ASPxClientGridView.EndCallback event.
See a similar issue discussed in this thread, and let me know if you need any clarification: aspxgridview can render aspxlabel after RowUpdating.
Thanks,
Alex
But then this would be called on every sorting, filtering, edit click etc. as well where as I just want to call it if it is a page change index changed
Anurag,
To determine that the callback is caused by changing the page index, use client-side properties enabled by the CustomJsProperties event.
Attached is a sample project illustrating this approach in action. Hope this helps.
BTW: Note that you can change hidden field values directly within the ASPxGridView.PageIndexChanged event handler.
Thanks,
Alex
Hi Alex,
Ideally I would like to change the hidden field value in pageindexchanged event but when I tried it didn't worked. the code is as given below. If I change these to ASPTextBox I can see the value is not set to blank.
string selectedContactInfoIds = hidSelectedContactInfoIds.Value.Trim();
if (selectedContactInfoIds.EndsWith(","))
{
selectedContactInfoIds = selectedContactInfoIds.Substring(0, (selectedContactInfoIds.Length - 1));
}
string[] arrSelectedContactInfoIds = selectedContactInfoIds.Split(',');
for (int i = 0; i < arrSelectedContactInfoIds.Length; i++)
{
if (arrSelectedContactInfoIds[i] != string.Empty && !SelectedCustomerIds.Contains(Convert.ToInt32(arrSelectedContactInfoIds[i])))
SelectedCustomerIds.Add(Convert.ToInt32(arrSelectedContactInfoIds[i]));
}
hidSelectedContactInfoIds.Value = string.Empty;
string unSelectedContactInfoIds = hidUnSelectedContactInfoIds.Value.Trim();
if (unSelectedContactInfoIds.EndsWith(","))
{
unSelectedContactInfoIds = unSelectedContactInfoIds.Substring(0, (unSelectedContactInfoIds.Length - 1));
}
string[] arrUnSelectedContactInfoIds = unSelectedContactInfoIds.Split(',');
for (int i = 0; i < arrUnSelectedContactInfoIds.Length; i++)
{
if (arrUnSelectedContactInfoIds[i] != string.Empty && SelectedCustomerIds.Contains(Convert.ToInt32(arrUnSelectedContactInfoIds[i])))
SelectedCustomerIds.Remove(Convert.ToInt32(arrUnSelectedContactInfoIds[i]));
}
hidUnSelectedContactInfoIds.Value = string.Empty;
Hi Anurag,
Thanks for the response. I'm afraid this behavior is by design.
As mentioned in the Q142094 thread, it's not quite correct to modify other controls during the ASPxGridView callback.
To modify hidden fields within the PageIndexChanged event handler, you might need to disable callbacks (see the ASPxGridView.EnableCallBacks property) and place both the text box and grid control onto the UpdatePanel. Let me know whether this makes sense.
Thanks,
Alex