开发者

IButtonControl And PostBackUrl

I'm trying to implement IButtonControl on a custom button control that does not derive from the normal ASP.NET button. I've got the events and properties all implem开发者_如何学运维ented and going from server to client.

The problem is that PostBackUrl only works when I have a regular button on the form. What I do is the following.

theForm.action = this._postbackUrl;
 __doPostBack(this._uniqueID, v);
 } catch (ex) { }

But I then get MAC ViewState Validation failed if I have just my button on the page and click it. Presumably this is because the site wasn't prepared to have it changed by my button, so thought it was unsafe.

Does anyone know a way around this. I've looked into the ASP button code and they do several things, some of which are internal.

None of these work. They include:

this.Page.ClientScript.RegisterForEventValidation(postbackOptions);
 // where postbackOptions is built based upon my control
m = Page.GetType().GetMethod("RegisterWebFormsScript", BindingFlags.Instance | BindingFlags.NonPublic);
        m.Invoke(Page, new object[] { });
        m = Page.GetType().GetMethod("RegisterPostBackScript", 

BindingFlags.Instance | BindingFlags.NonPublic);
m.Invoke(Page, new object[] { });

The last two were to get WebForms_DoPostbackWithOptions script to appear.

Has anyone run into similar problems or have some ideas?

Please and thank you, Dave

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜