This is a migrated thread and some comments may be shown as answers.

Validtaions in Different Tabs

2 Answers 122 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
raam
Top achievements
Rank 1
raam asked on 31 Jul 2008, 09:11 AM
Hi,

Iam new to telerik.
I have 6 tabs in my page..Each has textbox,dropdowns and datagrid controls.
Valdiations are working correctly but the problem is 
             Validation are done only if i enter some values in others tabs too.And the validtaion summary is generated in only one validation summary control.If i keep seperate control for validation summary in seperate tabs it's not displaying the validations.
    How can i get validation summaries in different tabs without effecting other tabs.Can any one help me.
    following is my code for one of the tabs.


<

cc1:TabPanel runat="server" id="tabPbill" Enabled="true" HeaderText="BillPlan" >

<ContentTemplate>

<table>

<tr>

<td align="left">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ClientName</td>

<td>&nbsp;<asp:DropDownList ID="ddbillcli" runat="server" Width="106px">

</asp:DropDownList>

<asp:RequiredFieldValidator ID="reqddbillcli" runat="server" ErrorMessage="Select Any ClientName" ControlToValidate="ddbillcli" InitialValue="--Select--" >*</asp:RequiredFieldValidator>

</td>

</tr>

<tr>

<td align="left">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ProgramName</td>

<td>&nbsp;<asp:DropDownList ID="ddbillpgm" runat="server" Width="106px">

</asp:DropDownList>

<asp:RequiredFieldValidator ID="reqddbillpgm" runat="server" ErrorMessage="Select Any ProgramName" ControlToValidate="ddbillpgm" InitialValue="--Select--" >*</asp:RequiredFieldValidator>

</td>

</tr>

<tr>

<td align="left">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;BillPlan</td>

<td>&nbsp;<asp:TextBox ID="txtbillplan" runat="server" Width="100px" ></asp:TextBox>

<asp:RequiredFieldValidator ID="reqtxtbillplan" runat="server" ControlToValidate="txtbillplan" ErrorMessage="Enter BillPlan" InitialValue="" Display="dynamic">*</asp:RequiredFieldValidator>

<asp:RegularExpressionValidator ID="regtxtbillplan" runat="server" ControlToValidate="txtbillplan" ErrorMessage="Enter Valid BillPlan" ValidationExpression="^[a-zA-Z]*[\s.,-]+[0-9]+$" Display="dynamic" >*</asp:RegularExpressionValidator>

</td>

</tr>

<tr><td><asp:ValidationSummary ID="ValidationSummary1" runat="server" /></td></tr>

<tr>

<td align="center" colspan="2"><asp:UpdatePanel ID="updbill" runat="Server">

<ContentTemplate>&nbsp;&nbsp;&nbsp;&nbsp;

<asp:ImageButton ID="btnbillsub" runat="server" ImageUrl="~/btnimages/submit.jpg" OnClick="btnbillsub_Click"/>

<asp:ImageButton ID="btnbillres" runat="server" ImageUrl="~/btnimages/reset.jpg" />

</ContentTemplate>

<Triggers>

<asp:AsyncPostBackTrigger ControlID="btnbillsub" EventName="Click" />

<asp:AsyncPostBackTrigger ControlID="btnbillres" EventName="Click" />

</Triggers>

</asp:UpdatePanel></td>

</tr>

<tr><td align="center" colspan="2"><asp:Label ID="lblmsg" runat="server" Font-Bold="true" ForeColor="gray" Font-Size="Small"></asp:Label></td></tr>

<tr><td align="center" colspan="2">&nbsp;</td></tr>

<tr><td align="center" colspan="2">

<asp:DataGrid ID="dgbill" runat="server" AllowPaging="True" PageSize="5" AutoGenerateColumns="False" CellPadding="4" ForeColor="#333333" GridLines="None" OnEditCommand="dgbill_EditCommand" OnCancelCommand="dgbill_CancelCommand" OnUpdateCommand="dgbill_UpdateCommand" OnItemDataBound="dgbill_ItemDataBound" OnPageIndexChanged="dgbill_PageIndexChanged" CssClass="DataGridFixedHeader">

<FooterStyle BackColor="#5D7B9D" ForeColor="White" Font-Bold="True" />

<SelectedItemStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />

<PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />

<ItemStyle ForeColor="#333333" BackColor="#F7F6F3" />

<HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />

<Columns>

<

asp:TemplateColumn HeaderText="BillPlanId" Visible="False">

<ItemTemplate>

<asp:Label runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.iBP_ID") %>' ID="lblid"></asp:Label>

</ItemTemplate>

<EditItemTemplate>

<asp:TextBox runat="server" ReadOnly="true" Text='<%# DataBinder.Eval(Container, "DataItem.iBP_ID") %>' ID="txtid"></asp:TextBox>

</EditItemTemplate>

</asp:TemplateColumn>

<asp:TemplateColumn HeaderText="Client">

<ItemTemplate>

<asp:Label runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.sCD_LegalName") %>' ID="ClientName"></asp:Label>

</ItemTemplate>

<EditItemTemplate>

<asp:DropDownList runat="server" Width="110px" DataSource='<%# client() %>' DataTextField="Client" DataValueField="iClient_ID" ID="editcli"></asp:DropDownList>

</EditItemTemplate>

</asp:TemplateColumn>

<asp:TemplateColumn HeaderText="Program">

<ItemTemplate>

<asp:Label runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.sPGM_Name") %>' ID="PgmName"></asp:Label>

</ItemTemplate>

<EditItemTemplate>

<asp:DropDownList runat="server" Width="110px" DataSource='<%# pgm() %>' DataTextField="sPGM_Name" DataValueField="iPGM_ID" ID="editpgm"></asp:DropDownList>

</EditItemTemplate>

</asp:TemplateColumn>

<asp:TemplateColumn HeaderText="BillPlan">

<ItemTemplate>

<asp:Label runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.sBP_Name") %>' ID="lblbillplan"></asp:Label>

</ItemTemplate>

<EditItemTemplate>

<asp:TextBox runat="server" Width="50px" Text='<%# DataBinder.Eval(Container, "DataItem.sBP_Name") %>' ID="txtbillplan"></asp:TextBox>

<asp:RequiredFieldValidator runat="server" ID="reqtxtbillplan" ControlToValidate="txtbillplan" ErrorMessage="Enter BillPlan" Display="dynamic">*</asp:RequiredFieldValidator>

<asp:RegularExpressionValidator runat="server" ID="regtxtbillplan" ControlToValidate="txtbillplan" ErrorMessage="Enter Valid BillPlan" Display="dynamic" ValidationExpression="[a-zA-Z]*[\s.,-]+[0-9]+">*</asp:RegularExpressionValidator>

</EditItemTemplate>

</asp:TemplateColumn>

<asp:TemplateColumn HeaderText="Delete">

<ItemTemplate>

<asp:CheckBox ID="chkbox" AutoPostBack="true" runat="server" Checked='<%# chked(Convert.ToInt64(DataBinder.Eval(Container.DataItem,"iLogicalDeletestatus"))) %>' OnCheckedChanged="chkbox_CheckedChanged" />

</ItemTemplate>

</asp:TemplateColumn>

<asp:BoundColumn DataField="iLogicalDeletestatus" HeaderText="Deletestatus" ReadOnly="True"

Visible="False"></asp:BoundColumn>

<asp:EditCommandColumn CancelText="Cancel" EditText="Edit" HeaderText="Edit" UpdateText="Update">

</asp:EditCommandColumn>

<asp:BoundColumn DataField="iBP_ID" ReadOnly="True" Visible="False"></asp:BoundColumn>

<asp:BoundColumn DataField="iClient_ID" ReadOnly="True" Visible="False"></asp:BoundColumn>

<asp:BoundColumn DataField="sCD_LegalName" ReadOnly="True" Visible="False"></asp:BoundColumn>

<asp:BoundColumn DataField="iPGM_ID" ReadOnly="True" Visible="False"></asp:BoundColumn>

<asp:BoundColumn DataField="sPGM_Name" ReadOnly="True" Visible="False"></asp:BoundColumn>

</Columns>

<AlternatingItemStyle BackColor="White" ForeColor="#284775" />

</asp:DataGrid>

</td></tr>

</table>

</ContentTemplate>

</cc1:TabPanel>

Thanks & Regards,
raam.

2 Answers, 1 is accepted

Sort by
0
raam
Top achievements
Rank 1
answered on 06 Aug 2008, 11:30 AM
I got it.

add validation summaries for different tabs.
if 6 tabs 6 validations summaries.
Next add attribute "validationgroup" for required field validators and textbox,dropdown controls etc including button which fires validations.

Then each tab gets validated seperately.

Thank you.
0
raam
Top achievements
Rank 1
answered on 06 Aug 2008, 11:32 AM
I got it.

add validation summaries for different tabs.
if 6 tabs 6 validations summaries.
Next add attribute "validationgroup" for required field validators and textbox,dropdown controls etc including button which fires validations.

Then each tab gets validated seperately.

Thank you.
Tags
TabStrip
Asked by
raam
Top achievements
Rank 1
Answers by
raam
Top achievements
Rank 1
Share this question
or