Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Capturing a postback inside a control.
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00761847
Message ID:
00762008
Vues:
13
Hi Mario,

In the Page_Load method add the following code, tweaking it to fit your control and javascript function:
MyControl.Attributes.Add("onchange","myfunction(parm1,parm2,parm3);");
In the javascript function add the following to call the postback:
__doPostBack('MycontrolID','')
>I have a lot of controls...and in runtime i need asign&run custom server validators.
>
>For example, i have a edit. In this, the user write a code, like "1". Then, i need go to the server (i need post the whole form in this case), run a function inside a dll made by the user, get the data and re-asign the data to the form, show error&warning if any, and put the validity of the form as well... But with this control, i need do a little of jscript here becuase is pluged with a combo, and if the data is not in it, then i need show another form and cancel the process...
>
>So, i put in a jscript function:
>
>function AsignarSeleccionado(combo,edit,postback){
> edit.value=combo.value;
> if (postback==true) {
> //window.Form1.submit();
> __doPostBack(combo.id,"");
> }
>}
>
>That work well, but when the form is posted to the server, the OnChange event of the edit is not fired. I try implementing IPostBackEventHandler.RaisePostBackEvent but the server not fire this event...
>
>I need a way to solve it. in short:
>
>- From a JSCript code, fire the postback
>- In the server, catch that i do a postback from x control
>- Run the custom code, rebind and back.
>
>Also, i don't see how put optionaly the fire event (that it, put this process in some controls and in others not)
>
>Thank for your time...
-----------------------------------------

Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.com
www.prenia.com
Weblog: blogs.prenia.com/cathi
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform