Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

how to separate validations of the grid and the page ?

Posted on 2009-05-19
4
Medium Priority
?
1,487 Views
Last Modified: 2012-05-07
I have a radgrid and an aspx page, there are validations on the page and separate validations on the radgrid. when a user clicks an Insert or Update (on the popup of an add or edit record) on the radgrid , I  want only the radgrid validations to fire not the page. how can I do this ?

<table width="300px" cellpadding="2px">
         <tr>
              <td align="right" style="width: 306px" rowspan="2">
                        Comments&nbsp;
                        <asp:RegularExpressionValidator ID="rev1" runat="server" ControlToValidate="txtSpecialInstructions"
                             ErrorMessage="Please limit comments to 240 characters or less." ValidationExpression="[\s\S]{0,240}">*</asp:RegularExpressionValidator>
	  	</td>	
	</tr>
</table>
 
<!-- radGrid --> 
 
<telerik:RadGrid ID="gridInvLines" AllowPaging="False" Skin="Office2007" 
        runat="server" AutoGenerateColumns="False" DataSourceID="odsInvLines" 
        GridLines="None" OnItemCommand="gridInvLines_ItemCommand" OnItemDataBound="gridInvLines_ItemDataBound" ShowFooter="True">
        <ClientSettings >
         <ClientEvents OnPopUpShowing="PopUpShowing"  />
        </ClientSettings>
        <MasterTableView DataKeyNames="LINE_NUMBER" DataSourceID="odsInvLines" EditMode="PopUp" InsertItemDisplay="Top"  AllowAutomaticInserts="true" AllowAutomaticUpdates="true" AllowAutomaticDeletes="true"  CommandItemDisplay="Top" CommandItemSettings-AddNewRecordText="Add New Line">
            <Columns>
               
             <telerik:GridTemplateColumn HeaderText="Line Description" HeaderStyle-HorizontalAlign="center" >
                  <HeaderStyle width="150px" />
                  <ItemStyle Width="150px" HorizontalAlign="left" />
                  <ItemTemplate>
                      <asp:Label  ID="Label1" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "DESCRIPTION") %>' >
                      </asp:Label>
                  </ItemTemplate>
                  <EditItemTemplate> 
                  <asp:RequiredFieldValidator ID="rfvLineDesc" ControlToValidate="txtLineDesc"
                   ErrorMessage="Please enter the Line Description" runat="server" Display="None">*</asp:RequiredFieldValidator> 
                    <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" Display="None"   ControlToValidate="txtLineDesc"
                             ErrorMessage="Please limit Line Description to 240 characters or less." ValidationExpression="[\s\S]{1,240}">*</asp:RegularExpressionValidator>
                      <asp:TextBox ID="txtLineDesc" runat="server" TextMode="MultiLine" Rows="4" Text='<%# Bind("DESCRIPTION") %>'  />
                  </EditItemTemplate>
              </telerik:GridTemplateColumn> 
          </Columns>
   <EditFormSettings EditColumn-UpdateText="Save" CaptionFormatString="Invoice Line Information" ColumnNumber="2">
                   <FormTableItemStyle Wrap="False" Width="100%"></FormTableItemStyle>
                    <FormCaptionStyle CssClass="EditFormHeader" Width="100%"></FormCaptionStyle>
                    <FormMainTableStyle GridLines="Horizontal" CellSpacing="0" CellPadding="3" BackColor="White"
                        Width="100%" />
                    <FormTableStyle CellSpacing="0" CellPadding="2" CssClass="module" Height="110px"
                        BackColor="White" />
                    <FormTableAlternatingItemStyle Wrap="False"></FormTableAlternatingItemStyle>
 
       <PopUpSettings  Modal="true" Width="600"  />
       </EditFormSettings>
        </MasterTableView>
        <ValidationSettings CommandsToValidate="PerformInsert,Update" />
       
    </telerik:RadGrid>

Open in new window

0
Comment
Question by:tech_question
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 9

Expert Comment

by:cdaly33
ID: 24422889
Does the radgrid have a validationgroup property that you can set on the grid and on the insert and update buttons?
0
 

Author Comment

by:tech_question
ID: 24423279
yes I believe there is. I did this and now I do not see the validation at all. do I need to mention the group ? Can you please provide an example as to how to do this ?
 <ValidationSettings CommandsToValidate="PerformInsert,Update" ValidationGroup="gridGroup" />
 
 <asp:RequiredFieldValidator ID="rfvLineDesc" ControlToValidate="txtLineDesc"
                   ErrorMessage="Please enter the Line Description" runat="server" ValidationGroup="gridGroup" Display="None">*</asp:RequiredFieldValidator> 
                 

Open in new window

0
 
LVL 7

Expert Comment

by:NicoJuicy
ID: 24423867
Just a hint.

Don't forget to put the validations on the page also in a (different) validationgroup.
0
 
LVL 3

Accepted Solution

by:
stu28bu earned 1500 total points
ID: 24628285
In your validator, you have the Display property set to "None".  This will cause the message to never be displayed.  Try a value of "Dynamic" and that should fix it if I understand your issue correctly.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question