Link to home
Start Free TrialLog in
Avatar of Takeoutdinner
Takeoutdinner

asked on

Skip <asp:RequiredFieldValidator

Hi experts,

I have MasterPage and SubPage. And SubPage has "<asp:RequiredFieldValidator ".
Using Hot Key In MasterPage, I try to go another screen without "<asp:RequiredFieldValidator ".
How can I skip this "<asp:RequiredFieldValidator "?
Please refer to my codes for this:

Thanks,




<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Add New" />
    protected void Button1_Click(object sender, EventArgs e)
    {
        string myForumID = ddlCategories.SelectedValue.ToString();
        Response.Redirect("~/AddEditPost.aspx?ForumID=" + myForumID);
    }

               <asp:TemplateField HeaderText="Name:">
                    <InsertItemTemplate>
                        <asp:TextBox ID="txtAddedBy" runat="server" Text='<%# Bind("AddedBy") %>' Width="99%"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="valRequireAddedBy" runat="server" ControlToValidate="txtAddedBy"
                            Display="Dynamic" ErrorMessage="RequiredFieldValidator" SetFocusOnError="True">Your name is required.</asp:RequiredFieldValidator>
                    </InsertItemTemplate>
ASKER CERTIFIED SOLUTION
Avatar of Anurag Agarwal
Anurag Agarwal
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Just set the Visible property to false.
Avatar of Bob Learned
Another possibility is to define validation groups, which gives you control over how things are validated:

Validation Groups in .NET
http://www.dotnet-guide.com/validationgroups.html
Avatar of Takeoutdinner
Takeoutdinner

ASKER

Thank you!