0
mtxtBdate.Value = dataGridView1.SelectedRows[0].Cells["Birthdate"].Value.ToString(); 

我在所有其他文本框中的 DataGridView 上使用此语法 - 但有人可以告诉我如何调整此 DatePicker 控件语法吗?我想获取用户DateTimePicker在数据网格上显示的日期上选择的日期。

mtxtfname.text = datagridView1.SelectRows[0].Cells["fIrstname"].value.ToString();

此语法适用于文本框,但适用于数据选择器?

4

1 回答 1

0

Make use of the combination of a <asp:TextBox> and <asp:CalendarExtender> control that targets a textbox where the selected date will be added

<asp:TextBox ID="txtBirthdate" runat="server"  
            CssClass="contentfield" Height="16px" MaxLength="12" 
             width="150px" Wrap="False"></asp:TextBox>
        <asp:CalendarExtender ID="CalendarExtender1" runat="server" 
            Format="dd MMM yyyy" PopupButtonID="imgSummaryCashFlowDate" 
            TargetControlID="txtBirthdate">
        </asp:CalendarExtender>

This will work exactly the same as a normal textbox in your gridview and you will be able to pull the date from the textbox exactly the same manner as you have done orignally.

于 2012-07-16T09:35:26.690 回答