Validate Checkbox and Checkboxlist

Posted by Venkat | Labels:

If we want to Validate the Textbox, Dropdownlist we used Validation Server Controls available in ASP.NET
Suppose if we want to validate Checboxlist or checkbox , some member validate through Javascript its good , some feed if its similar to Validator controls it should be easy to validate,.

so here is the link its similar to validation Server controls just Download the skmValidator Controls and add it on toolbox just drag and drop and set the errormessage , validationgroup, controltovalidate etc..

http://aspnet.4guysfromrolla.com/articles/092006-1.aspx 

If you want to do on Client side check this link

http://www.dotnetcurry.com/ShowArticle.aspx?ID=197&AspxAutoDetectCookieSupport=1

How to get Control Value From CreateUserWizard Control

Posted by Venkat | Labels: ,

Now I am going to discuss how to get the Controls Values ( ie:  Textbox , Dropdownlist etc.. ) inside the CreateUserWizard control, In CreateUserWizard Control on first view you can't able to get the Controls value directly.

Using FindControl i am getting the control value.

Write these Code on CreateUserWizard_CreatingUser Event

 DropDownList Questionddl = (DropDownList)CreateUserWizard.CreateUserStep.ContentTemplateContainer.FindControl("Question_DropDownList");
CreateUserWizard.Question = Questionddl.SelectedValue;

Set the Value has Selected to Listbox by getting value from Database

Posted by Venkat | Labels:

As we already saw how to get the items(Multiple selection item) from the Listbox. Suppose If we store that value like this(2,4,6,) ie: I concatenate the (,) for each valu -  2,4,6 are the value of the listbox so we are going to rebind this value to List and set it has Selected.

Here the subject is the field on the Table where the [ 2,4,6, ] was stored.

1) First we get the database value to string Variable

2) Then using Split property - remove the (,) from the String and assign to StringArray

3) Atlast use foreach loop to set the item to be selected.

  string subjectList = getUserProfile_SqlDataReader["subject"].ToString();
                            string[] subjectListItems = subjectList.Split(',');
                            foreach (string s in subjectListItems)
                            {
                                foreach (ListItem item in Subject_ListBox.Items)
                                {
                                    if (item.Value == s) item.Selected = true;
                                }
                            }

PayOffers.in