Click here to Skip to main content
15,903,201 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
This is my Html Code...
XML
<asp:UpdatePanel ID="Profits" runat="server" >
  <ContentTemplate>
  <asp:GridView Width="100%" border="1" ID="gwProfit" RowStyle-Wrap="true" runat="server" AutoGenerateColumns="false"
                                CssClass="datatable" AlternatingRowStyle-CssClass="alternaterow" FooterStyle-CssClass="datatableFooter"
                                FooterStyle-VerticalAlign="Bottom" HeaderStyle-CssClass="datatableHeader" RowStyle-VerticalAlign="Bottom"
                                ShowFooter="True" HeaderStyle-Wrap="true" OnRowDataBound="gwProfit_RowDataBound">
                                <Columns>
                                <asp:TemplateField HeaderText="Start Date">
                                        <ItemTemplate>
                   <%--    <div class="input-append">--%>
                       <asp:TextBox class="input_disabled" ID="txtStartDate" runat="server" Width="40px"  Height="22px">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    </asp:TextBox>
                    <button class="btn123" ID="ImgStartDate" runat="server" type="button" style="height:25px;">
                    <%--<i class="icon-calendar"></i>--%>
                    </button>
                    <%--      </div>--%>
                    <ajaxToolkit:CalendarExtender ID="StartDate" runat="server" TargetControlID="txtStartDate"
                    PopupButtonID="ImgStartDate" Format="dd-MMM-yyyy">
                    </ajaxToolkit:CalendarExtender>
                    </ItemTemplate>
                    <FooterTemplate>
            <asp:TextBox class="input_disabled" ID="txtNewStartDate" runat="server" Width="110px"  Height="22px">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            </asp:TextBox>
            <button class="btn123" ID="ImgStartDate" runat="server" type="button" style="height:25px;">
            <i class="icon-calendar"></i>
            </button>
            </div>
            <ajaxToolkit:CalendarExtender ID="StartDate" runat="server" TargetControlID="txtNewStartDate"
            PopupButtonID="ImgStartDate" Format="dd-MMM-yyyy">
            </ajaxToolkit:CalendarExtender>
            </FooterTemplate>
           </asp:TemplateField>







And COde behind I am wirting thid code....
GridViewRow row = gwProfit.Rows[indx];
TextBox txtRoomCategory = row.FindControl("txtStartDate") as TextBox;
DateTime dt = Convert.todatetime(txtRoomCategory.Text);


i want to do this selected save in dt but every time txtRoomCategory is Null...
Please Help me.....
Posted

1 solution

try this one..

foreach (GridViewRow gvRow in gwProfit.Rows)
{
TextBox txtRoomCategory = (TextBox)gwProfit.FindControl("txtStartDate");
String StartDate = txtRoomCategory .Text;
}


Accept as answer if solve you problem.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900