Ok so every now and then i finding myself in a situation where i need to pass tons of "Control.ClientID" from one JS function to another just because the way ASP.NET dynamically change the controls ID's so for example instead of having nice clean function like this
Code:btnSignUpSubmit.Attributes.Add("onclick", String.Concat(return FormValidation());
i'm ending up with this:
if the ID's wouldn't change i could get them from within the JS code.Code:btnSignUpSubmit.Attributes.Add("onclick", String.Concat(return FormValidation('", COSelectedLanguage.GetLanguageClientID, "','", ddlSelectLeague.ClientID , "','", ddlSelectRegion.ClientID , "','" ,txbTeamName.ClientID, "','" ,txbLoginName.ClientID ,"','",txbPassword.ClientID, "','" ,txbConfirmPassword.ClientID, "','",txbEmail.ClientID, "','", txbConfirmEmail.ClientID,"','" ,chbAgree.ClientID , "','", hdfisExistTeamName.ClientID,"','",hdfisExistLoginName.ClientID,"','",btnSignUpSubmit.ClientID ,"','",btnSignUpPostBack.ClientID ,"')"));
the solution i found for this is to give each of the controls fake (unique) CSS class and then i can get to each of this controls within the JS code without having to pass all of the id's ... is this bad practice?




If you Like it 
Reply With Quote