KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have a form HomePage.aspx containing an empty asp:Panel, a dropdownlist letting the user pick an SPFielType... on index changed, my HomePage.aspx.cs page will get the text selected and will load a user control inside the panel, this user control will generate a control based on the spfieldtype chosen by the user and a button calling the validateForm() function... my problem is that the Page_ClientValidate() function inside the validateForm() cant find the validator, i also tried to give a groupname but still not working. When Im putting the button inside my aspx page (not rendering dynamically) it is validating my page.( <asp:Button ID="submitbutton" Text="Validate" runat="server" /> ). But when Im rendering it dynamically , cant validate the form..This is what Im trying to do: protected override void CreateChildControls() { try { fieldRenderingControl = this.CreateFieldRenderingControl(this.FieldType); this.Controls.Add(fieldRenderingControl); Button button = new Button(); button.UseSubmitBehavior = false; button.Text = "ValidateButton"; button.ID = "ValidateButton"; button.OnClientClick = "validateForm()"; this.Controls.Add(button); RequiredFieldValidator newValidator = new RequiredFieldValidator(); newValidator.Text = "***"; newValidator.ID = "valideee"; newValidator.EnableClientScript = true; newValidator.Enabled = true; newValidator.SetFocusOnError = true; newValidator.Display = ValidatorDisplay.Dynamic; newValidator.ControlToValidate = fieldRenderingControl.ID; this.Controls.Add(newValidator); } catch (Exception ex) { } } // the CreateFieldRenderingControl() function will generate a control based on the argument fieldType chosen by the user. thanks in advance.
Tags (comma-separated)
Save Edits
Cancel