0

Hi

i have 3 textboxes, TBDate, TBRangeFrom, TBRangeTo.
I have use custom validation and insert code to validate date
but i need to use two different button to validate data in same webform.
For example
TBDate to use btn1 to validate and then when click will link to other form

whereas TBRangeFrom and TBRangeTo will use btn2 to validate and hence lead to another different form.. how am i going to make this happen?

because right now when i click just one button it will validate everything.=/

Edited by facadie: n/a

4
Contributors
6
Replies
7
Views
7 Years
Discussion Span
Last Post by Ramesh S
0

can you please eloborate,post yours Code.

Thx,
Chandru
<FAKE SIGNATURE>

Edited by peter_budo: Keep It On The Site - Do not manually post &quot;fake&quot; signatures in your posts. Instead, you may create a sitewide signature within the user control panel.

0

can you please eloborate,post yours Code.

Thx,
Chandru
NetProgrammingHelp.com

<%@ Page Language="C#" MasterPageFile="~/PATS.master" AutoEventWireup="true" CodeFile="Report.aspx.cs" Inherits="Report" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <br />
    <div style="text-align: left">
    <table style="font-family: arial">
        <tr>
            <td style="width: 147px; height: 21px; text-align: right">
                <strong>Generate Report</strong></td>
            <td style="width: 176px; height: 21px">
            </td>
            <td style="width: 22px; height: 21px">
            </td>
            <td style="width: 176px; height: 21px">
            </td>
        </tr>
        <tr>
            <td style="width: 147px; height: 28px;">
            </td>
            <td style="width: 176px; height: 28px;">
            </td>
            <td style="width: 22px; height: 28px;">
            </td>
            <td style="width: 176px; height: 28px;">
            </td>
        </tr>
        <tr>
            <td style="width: 147px; height: 20px; text-align: right">
                By Date</td>
            <td style="width: 176px; height: 20px">
                <asp:TextBox ID="TBDate" runat="server"></asp:TextBox>
                <asp:CustomValidator ID="CustomValidator1" runat="server" ErrorMessage="*" ControlToValidate="TBDate" OnServerValidate="CustomValidator1_ServerValidate"></asp:CustomValidator></td>
            <td style="width: 22px; height: 20px">
            </td>
            <td style="width: 176px; height: 20px">
            </td>
        </tr>
        <tr>
            <td style="width: 147px">
            </td>
            <td style="width: 176px">
                <asp:Button ID="BTNGenerateDate" runat="server" Text="Generate" Width="80px" /></td>
            <td style="width: 22px">
            </td>
            <td style="width: 176px">
            </td>
        </tr>
        <tr>
            <td style="width: 147px; height: 41px;">
            </td>
            <td style="width: 176px; height: 41px;">
            </td>
            <td style="width: 22px; height: 41px;">
            </td>
            <td style="width: 176px; height: 41px;">
            </td>
        </tr>
        <tr>
            <td style="width: 147px; text-align: right">
                By Range</td>
            <td style="width: 176px">
            </td>
            <td style="width: 22px">
            </td>
            <td style="width: 176px">
            </td>
        </tr>
        <tr>
            <td style="width: 147px; text-align: right">
                <em>From</em></td>
            <td style="width: 176px">
                <asp:TextBox ID="TBRangeFrom" runat="server"></asp:TextBox></td>
            <td style="width: 22px; text-align: right">
                <em>To</em></td>
            <td style="width: 176px">
                <asp:TextBox ID="TBRangeTo" runat="server"></asp:TextBox></td>
        </tr>
        <tr>
            <td style="width: 147px">
            </td>
            <td style="width: 176px">
                <asp:Button ID="BTNGenerateRange" runat="server" Text="Generate" Width="80px" /></td>
            <td style="width: 22px">
            </td>
            <td style="width: 176px">
            </td>
        </tr>
    </table></div>
    <br />
</asp:Content>

Hi i think with a picture you might understand what I'm trying to ask.=) cause Im usually not good at phrasing question.

1

Use ValidationGroup property.

The ASP.NET controls have a ValidationGroup property that, when set, validates only the validation controls within the specified group when the control triggers a post back to the server.

Votes + Comments
I always figured there was a better way. Now i know :)
0

Use ValidationGroup property.

The ASP.NET controls have a ValidationGroup property that, when set, validates only the validation controls within the specified group when the control triggers a post back to the server.

yea i did saw that so i just type under validation group. like the textbox i want to validate and the btn when click then it validate or???

0

The TextBox, Button controls should have same ValidationGroup. If you are using ValidationSummary, then you need to specifiy the ValidationGroup for it.

For your requirement, TBDate to use btn1 should have a ValidationGroup. TBRangeFrom, TBRangeTo and btn2 should have another ValidationGroup.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.