Sunday, February 12, 2006
Ok, I'm about to have a nervous breakdown and need to post this, and then walk away for a bit.
I have a gridview on a page, that looks like this:
<asp:gridview id="gvTest" runat="server" allowpaging="true" allowsorting="true" autogeneratecolumns="false" pagesize="5" onpageindexchanging="gvTest_PageIndexChanging" onrowcommand="gvTest_RowCommand" onsorting="gvTest_Sorting" enablesortingandpagingcallbacks="false">
<columns>
<asp:boundfield datafield="Id" headertext="Id" sortexpression="Id" />
<asp:boundfield datafield="Name" headertext="Name" sortexpression="Name" />
<asp:templatefield headertext="Preview">
<itemtemplate>
<asp:linkbutton id="linkPreview" runat="server" commandname="Preview" commandargument='<%#(int)DataBinder.Eval(Container.DataItem, "Id") %>' text="Preview" />
</itemtemplate>
</asp:templatefield>
</columns>
</asp:gridview>
I have an UpdatePanel that has triggers like this:
<triggers>
<atlas:controleventtrigger controlid="gvTest" eventname="RowCommand" />
</triggers>
Why then, when I sort or page the gridview, does the updatepanel swallow my postback, but when I click the linkbutton that says preview, do I get a postback?
I've been playing around with Atlas since the Jan CTP dropped a couple days ago. It's got some impressive functionality, as well as some (seemingly) glaring oversights. One of the things I'm trying to do is incorporate an UpdatePanel inside of a UserControl. I need the UpdatePanel to have a trigger that's on the containing page, but I can't get it to work. I've tried the following (on the containing page):
protected override void OnPreInit(EventArgs e)
{ ControlEventTrigger t = new ControlEventTrigger();
t.ControlID = this.linkGetFeedPreview.ID;
t.EventName = "Click";
previewControl.UpdatePanel.Triggers.Add(t);
base.OnPreInit(e);
}
I've also tried putting this code in OnInit, and have had no luck. I always get the error message The ControlID property of the trigger must reference a valid control. Has anyone else tried this and gotten it to work.
Another issue I've been having is that calls to a WebMethod in my page class aren't always executing. The javascript is: PageMethods.SomeMethodName(blah, onComplete, onTimeout, onError);. Many times when I execute that javascript, the error method immediately executes, and in the event viewer on that machine I'll see the following:
Event code: 4009
Event message: Viewstate verification failed. Reason: Viewstate was invalid.
Google has proven useless thus far. Anyone have any thoughts?