v
Not logged inv
SearchAsk a QuestionReport an IssueMake a SuggestionMy Questions and Issues
Issue Details
Find By ID

How to clear a textbox from PageIndexChanged event

Issue Details

Log in to Track Changes or Edit
Q201214
Question
Joe Fakhri
Yes
Processed
Customer Closed
.NET (ASP.NET)
ASPxGridView and Editors Suite
v8.3.5
Windows XP
Microsoft Visual Studio 2008
4/7/2009 1:39:59 PM
-> Created by Anurag Verma 4/3/2009 4:09:36 PM

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.

<- Processed (Answered) by DevExpress Team 4/6/2009 7:10:27 AM

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

-> Reactivated by Anurag Verma 4/6/2009 2:17:08 PM

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

<- Processed (Answered) by DevExpress Team 4/6/2009 2:37:19 PM

Attachment: Q142094.zip (369507 bytes)

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

-> Reactivated by Anurag Verma 4/6/2009 9:30:57 PM

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;

<- Processed (Answered) by DevExpress Team 4/7/2009 8:20:35 AM

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

<- Processed (Customer Closed) by Anurag Verma 4/7/2009 1:39:59 PM
Log in to Track Changes or Edit

Peer-to-Peer Discussion in DevExpress Forums

No discussion on this article has been started yet.

Please login to start discussion.

v
v
Search
Searching Tips