Calling a RequiredFieldValidator and ValidatorCallExtender inside GridView

I have a GridView with its columns being TextBoxes and after user made modifications to data within GridView I have a "Commit" Button thats located outside the GridView and also located under a different Content within the page... How do I set the Validator to work even though I have the validator set correctly but when I click on the "Commit" button it doesn't check for the validation and I believe its because the button is not inside the GridView or UpdatePanel... Is there a way to get around that? or A better approach? Thanks for your help in advance.

Please select a Test from the dropdown below.<br /> <asp:DropDownList ID="ddlResult" runat="server" onselectedindexchanged="ddlResult_SelectedIndexChanged" AutoPostBack="True" CausesValidation="false"> </asp:DropDownList> <br /> <asp:UpdatePanel ID="upGrid" runat="server"> <ContentTemplate> <asp:GridView ID="grdResults" runat="server" CssClass="gridview" RowStyle-CssClass="gridview_itm" AlternatingRowStyle-CssClass="gridview_aitm" HeaderStyle-CssClass="gridview_hdr" Width="100%" AutoGenerateColumns="False"> <Columns> <asp:TemplateField HeaderText="Test"> <ItemTemplate> <asp:Label ID="lblTest" runat="server" Text='<%#Eval("Test")%>'></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="Result"> <ItemTemplate> <asp:TextBox ID="tbResult" runat="server" Text='<%#Request.QueryString["t_ID"] == null ? null : Eval("n_Result") %>'></asp:TextBox> <asp:Label ID="lblResult" runat="server" Text='<%#Eval("Validate")%>' ForeColor="#D50000"></asp:Label> <asp:FilteredTextBoxExtender ID="ftbe" runat="server" TargetControlID="tbResult" FilterType="Custom, Numbers" ValidChars='<%#Eval("n_Mask")%>' /> <asp:RequiredFieldValidator runat="server" ID="RReq" ControlToValidate="tbResult" Display="None" ErrorMessage="A Result is required." /> <asp:ValidatorCalloutExtender runat="Server" ID="RReqE" TargetControlID="RReq" HighlightCssClass="validatorCalloutHighlight" /> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="Date Completed"> <ItemTemplate> <asp:TextBox ID="tbDate" runat="server" Text='<%#Request.QueryString["t_ID"] == null ? null : Eval("d_DateCompleted") %>'></asp:TextBox> <asp:Image ID="imgCalendar" runat="server" ImageUrl="~/App_Themes/Sugar2006/images/Calendar_scheduleHS.png" ImageAlign="Middle" /> <asp:CalendarExtender ID="ce" runat="server" TargetControlID ="tbDate" PopupButtonID="imgCalendar" /> <asp:MaskedEditExtender ID="mex" runat="server" TargetControlID="tbDate" Mask="99/99/9999" MaskType="Date" MessageValidatorTip="true" OnFocusCssClass="MaskedEditFocus" OnInvalidCssClass="MaskedEditError" /> <asp:MaskedEditValidator ID="mev" runat="server" ControlToValidate="tbDate" ControlExtender="mex" Display="Dynamic" InvalidValueMessage="This date is invalid!" Font-Bold="True" ForeColor="#D50000" /> <asp:RequiredFieldValidator runat="server" ID="DReq" ControlToValidate="tbDate" Display="None" ErrorMessage="A Date is required." /> <asp:ValidatorCalloutExtender runat="Server" ID="DReqE" TargetControlID="DReq" HighlightCssClass="validatorCalloutHighlight" /> </ItemTemplate> </asp:TemplateField> </Columns> </asp:GridView> <br /> <asp:Label ID="lblSave" runat="server" Text="**After Each Test Entry Please Save." ForeColor="#D50000"></asp:Label> </ContentTemplate> <Triggers> <asp:AsyncPostBackTrigger ControlID="ddlResult" EventName="SelectedIndexChanged" /> </Triggers> </asp:UpdatePanel> <asp:Content ID="Content1" ContentPlaceHolderID="cntSidebar" runat="server"> <asp:Button ID="btnSave" runat="server" Text="Save" Width="80%" onclick="btnSave_Click"/> <br /> <asp:Button ID="btnClose" runat="server" Text="Close" Width="80%" onclick="btnClose_Click" CausesValidation="false"/> </asp:Content>


Have you tried setting the following properties on the Commit button:

CausesValidation="true" ValidationGroup="vgMyGroup"

Also, try setting the validation controls property: ValidationGroup="vgMyGroup"

Another suggestion could be to do a postback on the Commit button's click event and check for


I would be interested to see if setting the ValidationGroup property persists across the ASP content controls.. Time:2012-03-29 Views:1

Related post

  • Adding Event Handler to DropDownList inside GridView - how to? 2010-05-03

    I have DropDownList inside GridView. Now I would like to add event handler for dropdownlist which would react on SelectedIndexChanged. I'm nesting DropDownList inside GridView by using RowDataBound event for GridView. (

  • Generating event for button inside gridview 2010-05-11

    In my project I'm showing a gridview in which I'hv included a buttonfield...I want to download a file, when user clicks the button inside gridview whose path is stored in database and the file is stored in localfile system... thanks in advance. -----

  • how to put value in Label inside gridview during runtime? 2010-06-14

    how to put value in Label inside gridview during runtime? I want to put dynamic values in my label inside gridview during pageload. here's my sample code private void SplitStrings() { List<string> listvalues = new List<string>(); listvalu

  • checkboxes inside gridview 2011-03-22

    I am using checkboxes inside gridview.. when clicking on the checkbox my code is not getting "IsChecked" value.. here is the code .. protected void ButtonDelete_Click(object sender, EventArgs e) { StringCollection sc = new StringCollection(); string

  • Validating checkboxes present inside gridview with Javascript 2011-09-22

    Possible Duplicate: Validating checkboxes present inside gridview with Javascript This is my aspx code... <asp:TemplateField HeaderText="IsExist"> <ItemTemplate> <asp:CheckBox ID="chkExists" runat="server" Text="Exists" AutoPostBack="f

  • How to access DropDownList Control's selected value inside GridView ItemTemplate using JavaScript? 2011-10-11

    I have GridView with DropDownList items inside its ItemTemplate. Now, I want to access the SelectedValue of each DropDownList control inside GridView using JavaScript. How can I do this? --------------Solutions------------- Im just guessing this is w

  • views inside GridView becomes too small like single line 2011-11-10

    my xml look like this. I have LinearLayout inside HorizontalScrollView and that LinearLayout has two GridView. In below code com.muvee.vea.view.GridViewFrame is the class which extends GridView so that i can set its widht according to its parents scr

  • FileUpload.HasFile property is always false,While File Upload is place inside GridView 2011-12-06

    I have Tab Container, and i have a GridView inside that. I need to upload image while i am clicking on the particular row. I am using update Panel too, outside of the grid view, i was able to upload image using PostBack Trigger to "preview Button", b

  • Click event of asp image-button inside gridview using jquery 2012-01-24

    i have a grid-view, which contains an asp image-button for deleting row, i want to get the click event of that image-button using jquery, i want to animate the row before that row is deleted from database, i dont know what could be the best code for

  • Numeric validation for textbox inside Gridview 2012-01-31

    I have textbox inside gridview. need to validate this textbox for numeric values.i tried using below code but its giveng me object required code is as shown below. <asp:TabContainer ID="tcexe" runat="server" ActiveTabIndex="0" AutoPostBac

  • How to get row count inside Gridview label 2012-03-04

    I have an ItemTemplate Label inside Gridview which I haven't bound with any DataField. I have userId as one of the columns of GridView. Based on the userId column, I want to get total no of assets acquired by the User. The totalNo doesn't exists in t

  • Accessing TextArea Inside GridView with JQuery BlockUI 2009-05-19

    This is driving me nuts! I am trying to access a TextArea inside the GridView control. The TextArea is popped up when a button on a gridview is clicked. For some reason the textarea.value always contains " ". <asp:GridView ID="gvCategories" runat=

  • Dynamic textbox inside gridview tab key press 2009-11-16

    We are using dynamic text box inside the gridview. When tab key pressed on each textbox inside the grid we need to do some calculation using total value from the database and value in the previous textbox and the result should be displayed in the nex

  • asp:linkbutton inside gridview 2009-12-23

    I have a serverside dropdownlist and I am accessing it's id in jquery like this $('#<%=ddldropdownlist.clientID%>') I have a asp:LinkButton inside a gridview and I want to access it's client ID. when I do as above in jquery it doesn't work I th

  • Access Control inside GridView Pager Template - ASP.NET 2010-01-06

    I am trying to access a LinkButton that is inside a PagerTemplate in a GridView. However, I am getting a NullReferenceException and I don't know what I am doing wrong here. I have tried the following... ((LinkButton)GridView1.BottomPagerRow.FindContr

  • Button command firing twice with ButtonField inside GridView inside UpdatePanel with FireFox 2010-02-06

    I have an update panel which contains a GridView, inside which is a ButtonField. Whenever I press the button I see Firefox doing two POST's (via Firebug). One gets aborted right away, but does reach the server. This causes problems on my server side

  • onCommand on button not firing inside gridView? 2010-04-23

    This is really driving me crazy. I've got a button inside a gridview to remove that item from the gridview (its datasource is a list). I've got the list being saved to session anytime a change is being made to it, and on page_load check if that sessi

  • PopUpExtender on ImageButton inside GridView problem 2010-10-30

    I have GridView on my page, one column in that grid is ImageButton (TemplateField with ID="imbReserve"). On click on that button I want to show PopUp, but when I put TargetControlId="imbReserve" I get error message " A control with ID 'imbRes

  • Javascript validation inside gridview cell 2010-11-13

    I have a single entry master with country name in a gridview . I have to edit the data in a grid view in c#. I want to validate the textbox inside edit template to see if the user enters invalid characters. I want to validate that using simpl

Copyright (C), All Rights Reserved.

processed in 0.733 (s). 13 q(s)