By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,018 Members | 1,204 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,018 IT Pros & Developers. It's quick & easy.

Validation in ajax

P: 11
Hi,
I have ajax tab container with 6 tabs in it.
I need to validate each tab contents separately and the validtaion summary must be separate for each tab.
i cannot do that only one summary is being accesed.
i also tried with validationgroup.
Finlly i want each tab content to be validated and the content should accept the inputs.If any errors the message must display in summary separately.

Here are 2 of my tabs.Dont feel bore pls let me know the procedure.
Thanks in advance.For understanding i have send complete form.

[HTML]<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" ValidationGroup="valgrp1"></asp:TextBox>
<asp:RequiredFieldValidator ID="reqtxtbillplan" runat="server" ControlToValidate="txtbillplan" ErrorMessage="Enter BillPlan" InitialValue="" Display="dynamic" ValidationGroup="valgrp1">*</asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="regtxtbillplan" runat="server" ControlToValidate="txtbillplan" ErrorMessage="Enter Valid BillPlan" ValidationExpression="^[a-zA-Z]*[\s.,-]+[0-9]+$" Display="dynamic" ValidationGroup="valgrp1">*</asp:RegularExpressionValidator>
</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.Da taItem,"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>

<cc1:TabPanel runat="server" id="tabPphone" Enabled="true" HeaderText="PhoneType">
<ContentTemplate>
<table><tr><td>&nbsp;</td></tr><tr><td>&nbsp;</td></tr>
<tr>
<td align="left" nowrap="nowrap">Phone Type</td>
<td><asp:TextBox ID="txtphonetype" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="reqtxtphonetype" runat="server" ControlToValidate="txtphonetype" ErrorMessage="Enter Phone Type" InitialValue="" Display="dynamic">*</asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="regtxtphonetype" runat="server" ControlToValidate="txtphonetype" ErrorMessage="Enter Valid Phone Type" ValidationExpression="^[a-zA-Z]*$" Display="dynamic">*</asp:RegularExpressionValidator>
</td>
<%--<tr><td colspan="2" align="left"><asp:ValidationSummary ID="valsumph" runat="server"/></td></tr>--%>
</tr>
<tr>
<td align="center" colspan="2"><asp:UpdatePanel ID="updphone" runat="Server">
<ContentTemplate>
<asp:ImageButton ID="btnphonesub" runat="server" ImageUrl="~/btnimages/submit.jpg" OnClick="btnphonesub_Click"/>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnphonesub" EventName="Click" />
</Triggers>
</asp:UpdatePanel></td></tr>
<tr><td align="center" colspan="2"><asp:Label ID="lblmsgph" 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="dgphone" runat="server" AutoGenerateColumns="False" CellPadding="4" ForeColor="#333333" GridLines="None" OnEditCommand="dgphone_EditCommand" OnCancelCommand="dgphone_CancelCommand" OnUpdateCommand="dgphone_UpdateCommand" 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:BoundColumn DataField="iPhType_ID" ReadOnly="True" Visible="False"></asp:BoundColumn>
<asp:TemplateColumn HeaderText="PhoneTypeID" Visible="False">
<ItemTemplate>
<asp:Label runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.iPhType_ID") %>' ID="lblphid"></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox runat="server" ReadOnly="true" Text='<%# DataBinder.Eval(Container, "DataItem.iPhType_ID") %>' ID="txtphid"></asp:TextBox>
</EditItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="PhoneType">
<ItemTemplate>
<asp:Label runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.sPhType_Type") %>' ID="lblphtype"></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox runat="server" Width="100px" Text='<%# DataBinder.Eval(Container, "DataItem.sPhType_Type") %>' ID="txtphtype"></asp:TextBox>
<asp:RequiredFieldValidator ID="reqtxtphtype" runat="server" ControlToValidate="txtphtype" Display="dynamic" ErrorMessage="Enter PhoneType" ValidationGroup="valgrp2">*</asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="regtxtphtype" runat="server" ControlToValidate="txtphtype" Display="Dynamic" ErrorMessage="Enter Valid PhoneType" ValidationExpression="[a-zA-Z]*">*</asp:RegularExpressionValidator>
</EditItemTemplate>
</asp:TemplateColumn>
<asp:EditCommandColumn CancelText="Cancel" EditText="Edit" HeaderText="Edit" UpdateText="Update">
</asp:EditCommandColumn>
</Columns>
<AlternatingItemStyle BackColor="White" ForeColor="#284775" />
</asp:DataGrid></td></tr>
</table>
</ContentTemplate>
</cc1:TabPanel>[/HTML]
Jul 29 '08 #1
Share this Question
Share on Google+
1 Reply


P: 11
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.
Aug 6 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.