Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Presenting confirm dialogs from server side code
Message
De
13/12/2003 12:16:58
 
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00858238
Message ID:
00858918
Vues:
20
>You don't really need to worry about this if you can get the text you need in there at the design time. IOW, if the text is static just put it in there. If it's dynamic you can still get it into the HTML using classic ASP tags (<%= this.Caption for example).
>


Cool, I understand.

>If you rather do it in code you can use the Form's Attribute collection and add the onsubmit handler. For example:
>
>this.form1.Attributes.Add("onsubmit","alert('form submitting');return true;");
>
>This is the same thing as attaching the onsubmit handler within the HTML, but it gives you control to do this in code so if you need to customize the message or code logic you cna do that here nicely.
>


That makes sense, thanks for clarifying that.

>In addition there are RegisterClientScriptBlock and RegisterStartupScript which can set up script functions and client code that fires when a form loads.
>
>In essence you can do whatever you do in script in the HTML through code.
>
>I'm not a big fan of doing this though, because unless you really have some logic that requires processing during the generation, there's no need to stick this stuff into your code. It only makes the server code more confusing and less readable...


Right on, this is good to know also.

I think that once I realized that the program flow control really could be in the client rather than the server side code and I could call code on the server from the client the light bulb went on, :-). And also knowing that the reverse is also possible but maybe not as prefereable is also a good thing too. I'm still looking for some best practice info on this topic, not finding much though. Maybe someone reading this knows of something to reference.

I really appreciate your jumping in on this one with a detailed response. Mahalo nui loa kahuna!
Kendall Webb
Senior Software Engineer
MCAD.Net/MCSD.Net
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform