PostBackEvent

  • Thread starter Thread starter Arthur Carré
  • Start date Start date
A

Arthur Carré

Hi everyone, i have an ASP.net webapplication and have a big problem.

I found how to solve it, but in the page_load event of my page, i need to
know the ID of the control that caused the postback. How can i find the
info ??

Thanks in advance, Arthur

(PLZ, answer in the newsgroup)
 
c#

ctlPostBack = webPage.Page.Request.Form.GetValues("__EVENTTARGET");
string controlname = ctlPostBack[0]

regards

KV
 
Sorry error in previous message

c#

string[] ctlPostBack;
ctlPostBack = webPage.Page.Request.Form.GetValues("__EVENTTARGET");
if (ctlPostBack != null && ctlPostBack.Length > 0)
{
string ctlUniqueId;
ctlUniqueId = ctlPostBack[0];
System.Web.UI.Control findControl =
webPage.Page.FindControl(ctlUniqueId);
if ((findControl != null) &&
(findControl is DropDownList ||
findControl is TextBox ||
findControl is RadioButton ||
findControl is RadioButtonList))
{
string ctlControlName;
ctlControlName= findControl.ClientID;
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top