Skip Navigation Links
C# Corner Home
Forum Home
Latest 50
Unanswered
Win Prizes
All Time Leaders
Jump to CategoryExpand Jump to Category
Login 
    Welcome Guest!
 Search Forum For :  
X
 Login
Please login to submit a new post, reply and edit exiting posts, see user profiles, and access more features. If you are not a registered member, Register here.
User Id / Email:
Password:  
Forgot Password | Forgot UserName
   Home » C# Language » ValidatorCalloutExtender not working in gridview....
       
Author Reply
avijit chatterjee
posted 16 posts
since Dec 29, 2009 
from

ValidatorCalloutExtender not working in gridview....

  Posted on: 28 Aug 2010       
hi ...
I am sending .aspx page and code behind page ,where what i want to do is i used RequiredFieldValidator and  ValidatorCalloutExtender  both and one link is their called AddNew. When  user hit the Addnew link and if txt_srno field is empty  then requiredfieldvalidator get fire and error message will show. 

please someone help me get the answer...
.aspx page---->
<asp:TemplateField HeaderText="Sr No" HeaderStyle-HorizontalAlign="Left" HeaderStyle-VerticalAlign="Top" HeaderStyle-Width="30">
                                <ItemStyle HorizontalAlign="Center" />
                                
                                
                                
                                    <ItemTemplate>
                                    <asp:Label ID="lbl_srno" runat="server" Text='<%# Eval("srno") %>'></asp:Label>
                                    </ItemTemplate>
                                    <EditItemTemplate>
                                    <asp:TextBox ID="txt_srno" Enabled="true" runat="server" Text='<%# Eval("srno") %>'></asp:TextBox>
                                    
                                   </EditItemTemplate>
                                     <FooterTemplate>
                                      <asp:TextBox ID="txtnew_srno" runat="server" Width="30"></asp:TextBox>
                                      <asp:RequiredFieldValidator ID ="RequiredFieldValidator2" 
                                      runat="server" 
                                      Display="Dynamic"
                                       EnableClientScript="false"
                                        EnableViewState="false"
                                         ValidationGroup="Group1"
                                      ControlToValidate="txtnew_srno"
                                      ErrorMessage="Inter SrNo."
                                      CssClass="error">
                                      </asp:RequiredFieldValidator>
                                      <AjaxToolkit:ValidatorCalloutExtender ID="ValidatorCalloutExtender2"
                                       runat="server"
                                       TargetControlID="RequiredFieldValidator2"
                                       HighlightCssClass="Highlight"
                                       PopupPosition="TopLeft">
                                      </AjaxToolkit:ValidatorCalloutExtender>
                                     </FooterTemplate>
                                
                                
                      </asp:TemplateField>

<asp:TemplateField HeaderText="Edit" ShowHeader="False">
                    <ItemTemplate> 
                             <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Edit" Text="Edit"></asp:LinkButton> 
                        </ItemTemplate> 
                    <EditItemTemplate> 
                      <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" CommandName="Update" Text="Update"></asp:LinkButton> 
                      <asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel"></asp:LinkButton> 
                    </EditItemTemplate> 
                    <FooterTemplate>
                     
                      <asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False"
                       
                       CommandName="AddNew" ValidationGroup="Group1" EnableViewState="false" Text="Add New"></asp:LinkButton> 
                      
                    </FooterTemplate> 
                    
                   
       </asp:TemplateField>


codebehind page......

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            ContractorCls cons = new ContractorCls();
            
            TextBox txt_srno = (TextBox)e.Row.FindControl("txt_srno") as TextBox;
            DropDownList cmbcontractor_name = e.Row.FindControl("cmbcontractor_name") as DropDownList;
            TextBox txtlabour_name = e.Row.FindControl("txtlabour_name") as TextBox;
            DropDownList cmbshift = e.Row.FindControl("cmbshift") as DropDownList;
            TextBox txtentry_time = e.Row.FindControl("txtentry_time") as TextBox;
            TextBox txtexit_time = e.Row.FindControl("txtexit_time") as TextBox;
            TextBox txtlocation = e.Row.FindControl("txtlocation") as TextBox;
            TextBox txtjob_desc = e.Row.FindControl("txtjob_desc") as TextBox;
            TextBox txtstart_time = e.Row.FindControl("txtstart_time") as TextBox;
            TextBox txtend_time = e.Row.FindControl("txtend_time") as TextBox;
            TextBox txtOT_from = e.Row.FindControl("txtOT_from") as TextBox;
            TextBox txtOT_end = e.Row.FindControl("txtOT_end") as TextBox;
            TextBox txtOT_reason = e.Row.FindControl("txtOT_reason") as TextBox;
}
}

protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
      {



          ContractorCls cons = new ContractorCls();
          if (e.CommandName.Equals("AddNew"))
          {

              TextBox txtnew_srno = (TextBox)GridView1.FooterRow.FindControl("txtnew_srno");
              DropDownList cmbnewcontractor_name = (DropDownList)GridView1.FooterRow.FindControl("cmbnewcontractor_name");
              TextBox txtnewlabour_name = (TextBox)GridView1.FooterRow.FindControl("txtnewlabour_name");
              DropDownList cmbnewshift = (DropDownList)GridView1.FooterRow.FindControl("cmbnewshift");
              TextBox txtnewentry_time = (TextBox)GridView1.FooterRow.FindControl("txtnewentry_time");
              TextBox txtnewexit_time = (TextBox)GridView1.FooterRow.FindControl("txtnewexit_time");
              TextBox txtnewlocation = (TextBox)GridView1.FooterRow.FindControl("txtnewlocation");
              TextBox txtnewjob_desc = (TextBox)GridView1.FooterRow.FindControl("txtnewjob_desc");
              TextBox txtnewstart_time = (TextBox)GridView1.FooterRow.FindControl("txtnewstart_time");
              TextBox txtnewend_time = (TextBox)GridView1.FooterRow.FindControl("txtnewend_time");
              TextBox txtnewOT_from = (TextBox)GridView1.FooterRow.FindControl("txtnewOT_from");
              TextBox txtnewOT_end = (TextBox)GridView1.FooterRow.FindControl("txtnewOT_end");
              TextBox txtnewOT_reason = (TextBox)GridView1.FooterRow.FindControl("txtnewOT_reason");
              cons.Insert(Convert.ToInt32(txtnew_srno.Text), cmbnewcontractor_name.SelectedValue, txtnewlabour_name.Text, cmbnewshift.SelectedValue, txtnewentry_time.Text, txtnewexit_time.Text, txtnewlocation.Text, txtnewjob_desc.Text, txtnewstart_time.Text, txtnewend_time.Text, txtnewOT_from.Text, txtnewOT_end.Text, txtnewOT_reason.Text);
              fillgrid();
          }
      }

help me please....

thanks...



  
       
Nevron Gauge for SharePoint
Dynamic PDF
ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications. Visit DynamicPDF here
Introducing MaxV - one click. infinite control. Hyper-V Hosting from MaximumASP.
Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
Nevron Chart for .NET 2010.1 Now Available
The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
ASP.NET 4 Hosting
Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites - Click Here!
Team Foundation Server Hosting
 Hosted by MaximumASP  |  Found a broken link?  |  Contact Us  |  Terms & conditions  |  Privacy Policy  |  Site Map  |  Advertise with us
Current Version: 5.2011.3.12
 © 1999 - 2012  Mindcracker LLC. All Rights Reserved