Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6906515
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:19:13+00:00 2026-05-27T08:19:13+00:00

I have a GridView which allows users to enter data using a EmptyDataTemplate. There

  • 0

I have a GridView which allows users to enter data using a EmptyDataTemplate. There is a text box having a calendarextender. I want to get the date entered (format MM/dd/yyyy) and pass it to the database.

Please let me know how to do it.

My code:

<asp:GridView ID="GV_Rotl_Asgt" runat="server" EnableModelValidation="True" 
               BackColor="White" BorderColor="#999999" BorderStyle="None"
                            BorderWidth="1px" CellPadding="3" Font-Names="Arial" 
                  Font-Size="8pt" GridLines="Vertical"                                
                            AllowSorting="True" EnableSortingAndPagingCallbacks="True" AutoGenerateColumns="False"
                           Width="1196px"                                                              
                           ShowFooter="True" OnRowCommand="GV_RowCommand" DataKeyNames="Emplid">

             <FooterStyle BackColor="#CCCCCCC" ForeColor="Black" />
             <PagerSettings PageButtonCount="1000" />
             <RowStyle BackColor="#EEEEEE" ForeColor="Black" />
             <Columns> 
                    <asp:TemplateField HeaderText="Action" HeaderStyle-ForeColor="#00349C"> 
                       <ItemTemplate>
                         <asp:LinkButton ID="btnEdit" Text="Edit" runat="server" CommandName="Edit" CssClass="infotitle" /> <br /> 
                         <asp:LinkButton ID="btnDelete" Text="Delete" runat="server" CommandName="Delete"  CssClass="infotitle"/> 
                       </ItemTemplate>
                       <EditItemTemplate> 
                         <asp:LinkButton ID="btnUpdate" Text="Update" runat="server" CommandName="Update"  CssClass="infotitle" />
                         <asp:LinkButton ID="btnCancel" Text="Cancel" runat="server" CommandName="Cancel"  CssClass="infotitle"/>
                       </EditItemTemplate>
                       <FooterTemplate>
                         <asp:LinkButton runat="server" ID="Insert" Text="Insert" CommandName="InsertNew" CssClass="infotitle" />
                         <asp:LinkButton runat="server" ID="Cancel" Text="Cancel" CommandName="CancelNew" CssClass="infotitle" />
                       </FooterTemplate>
                    </asp:TemplateField> 
                 </Columns>
                 <EmptyDataTemplate>
                 <table id="NoDatatbl" width="100%" style="margin-right: 0px">
                    <tr>
                      <td class="ColumnHead" width="150px">
                             To Date</td>
                      <td class="ColumnHead" width="150px">
                             From Date</td>
                      <td class="ColumnHead" width="150px">
                             Rotational Assignment</td>
                      <td class="ColumnHead" width="150px">
                             Location</td>
                      <td class="ColumnHead" width="150px">

                       </td>
                    </tr>
                    </table>
                    <table id="NoDatatbl1" width="100%" style="margin-right: 0px">
                    <tr>
                      <td class="ColumnHead" width="150px">
                           <asp:TextBox runat="server" ID="NodataToDt" format="MM/dd/yyyy"/> 
                          <asp:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="NodataToDt" format="MM/dd/yyyy"/>
                         </td>
                      <td class="ColumnHead" width="150px">
                            <asp:TextBox runat="server" ID="NodatafrmDt" format="MM/dd/yyyy"/>
                            <asp:CalendarExtender ID="CalendarExtender2" runat="server" TargetControlID="NodatafrmDt" format="MM/dd/yyyy"/>

                            <asp:CompareValidator ID="CompareValidator1" runat="server" ControlToValidate="NodatafrmDt" ControlToCompare="NodataToDt" Operator="GreaterThanEqual"
                              Display="Dynamic" ErrorMessage="From Date should be greater than To Date" 
                             Type="Date"></asp:CompareValidator>
                          <asp:ValidatorCalloutExtender ID="CompareValidator1_ValidatorCalloutExtender" runat="server" Enabled="True" TargetControlID="CompareValidator1">
                            </asp:ValidatorCalloutExtender>


                             </td>
                      <td class="ColumnHead" width="150px">
                              <asp:TextBox runat="server" ID="NodataRotl" /></td>
                      <td class="ColumnHead" width="150px">
                              <asp:TextBox runat="server" ID="NodataLoc" /></td>
                      <td class="ColumnHead" width="150px">
                       <asp:LinkButton runat="server" ID="LinkButton1" Text="Insert" CommandName="NoDataInsert" CssClass="infotitle" />
                       </td>
                    </tr>
                    </table>
                 </EmptyDataTemplate>
    </asp:GridView>

Basically, I want to fetch the values from the NodataToDt & NodatafrmDt textboxes in codebehind and pass the values to my stored procedure.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T08:19:13+00:00Added an answer on May 27, 2026 at 8:19 am

    In your code behind:

    // Find the 2 text boxes within your GridView control
    TextBox toDateTextBox = (TextBox)GV_Rotl_Asgt.FindControl("NodataToDt");
    TextBox fromDateTextBox = (TextBox)GV_Rotl_Asgt.FindControl("NodatafrmDt");
    
    // Grab the values out of those text boxes
    string toDate = toDateTextBox.Text;
    string fromDate = fromDateTextBox.Text;
    

    From there, you can do whatever you need with those two string values.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a GridView which binds data from DB, and using rowboundevent, I want
I have a gridview within an updatepanel which allows paging and has a linkbutton
I have a gridview which is databound, I want to dynamically add a row
Have a gridview control which will show X amount of rows. I want to
I have a GridView which displays in excess of 30000 rows, and users need
I have a GridView which is showing some data: Entity_ID (PK) Name Description Now
I have gridview which has columns of data and a button below the Apply
I have GridView which I can select a row. I then have a button
I have a GridView which I am populating by calling a method to return
I have a GridView which is databound to an XML Datasource. For one of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.