Ajax calendar Extender选择日期保存在变量问题中.. [英] Ajax calendar Extender Selected date save in variable problem..

查看:54
本文介绍了Ajax calendar Extender选择日期保存在变量问题中..的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的Html代码...

This is my Html Code...

<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>















和COde背后我正在编写代码....

GridViewRow row = gwProfit.Rows [indx];

TextBox txtRoomCategory = row.FindControl(txtStartDate)as TextBox;

DateTime dt = Convert.todatetime(txtRoomCategory.Text);





i想要这样做选择保存在dt中,但每次txtRoomCategory为空时...

请帮助我.....








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.....

推荐答案

试试这个。 。



foreach(gwProfit.Rows中的GridViewRow gvRow)

{

TextBox txtRoomCategory =(TextBox)gwProfit .FindControl(txtStartDate);

String StartDate = txtRoomCategory .Text;

}





如果解决问题,请接受答案。
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.


这篇关于Ajax calendar Extender选择日期保存在变量问题中..的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆