0
votes

I'm having a problem and I cannot understand why. I have a GridView and some other controls in an UpdatePanel. I'm trying to select a row by clicking anywere on it, so I'm using the following code to make the selection possible:

 r.Attributes.Add("onclick","javascript:" + Page.ClientScript.GetPostBackEventReference(grdUtilizatori, "Select$" +r.RowIndex,true));

My problem is that the page is making full postback (the entire page is coming back from the server, not just the updatepanel).

If I'm using a simple Select command, the postback will be just partial. I compared the generated source for the page and the javascript looks identical.

<a     href="javascript:__doPostBack(&#39;ctl00$CPH$grdUtilizatori&#39;,&#39;Select$1&#39;)">Select</a>
<tr onclick="javascript:__doPostBack(&#39;ctl00$CPH$grdUtilizatori&#39;,&#39;Select$0&#39;)">

Can you please tell me what am I doing wrong?

1
I've implemented the same solution and everything works well. Did you turn off the event validation - EnableEventValidation ="false" in the Page directive? - Andrei Schneider
No, I let it to be true. Should I set it to false? - mslliviu
Look at my answer below. - Andrei Schneider

1 Answers

1
votes

I found a solution on web, I've added to the update panel the following

<Triggers>
            <asp:AsyncPostBackTrigger ControlID="grdUtilizatori" 
                EventName="SelectedIndexChanged" />
        </Triggers>