[RESOLVED] how to cerated validation control dynamically and apply for dynamically created control

Hi,I am working on asp.net,my task is,creating control dynamically, in page i have created only one row,i have dropdownlist,3 TextBoxes,in first drop down i have category,second dropdown i have information,remaining 2 textboxes i am entering values,i am calling this method on every page  load,when i clcik + image i am adding another row,when i clicked Minus,i am removing oner row,if ok, when i click the save button,i need do the validation by using validation control.how i can created required field validator dynamically,how i can apply when i click the save button,i have plus button,minus buttotn,dropdown selected index chnged ,can any onr reply to plhkrishna@hotmail.com


When you add the textbox, add Validator below:

For example:

input = new TextBox();
            input.ID = "id";

            validate = new RequiredFieldValidator();
            validate.ID = "valid";
            validate.ControlToValidate = input.ID;
            validate.ErrorMessage = "require";
            validate.Display = ValidatorDisplay.Dynamic;

<div class="entry">
TextBox objtext = new TextBox();
RequiredFieldValidator objReq = newRequiredFieldValidator();
objtext.ID = "MyTextBox";
objReq.ControlToValidate = objtext.ID;
objReq.ErrorMessage = "Please tell us some thing";
</div> </div>

thoughts on "[RESOLVED] how to cerated validation control dynamically and apply for dynamically created control"

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>