首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

calendar控件向detailsview输入日期,该如何处理

2012-01-19 
calendar控件向detailsview输入日期asp:DetailsViewID DetailsView1 runat server Height 50px

calendar控件向detailsview输入日期
<asp:DetailsView   ID= "DetailsView1 "   runat= "server "   Height= "50px "   Width= "600px "   AutoGenerateInsertButton= "True "   AutoGenerateRows= "False "   DataKeyNames= "ID "   DataSourceID= "SqlDataSource1 "   DefaultMode= "Insert ">
                        <RowStyle   HorizontalAlign= "Center "   />
                        <Fields>
                                <asp:BoundField   DataField= "ID "   HeaderText= "ID "   InsertVisible= "False "   ReadOnly= "True "
                                        SortExpression= "ID "   />
                                <asp:BoundField   DataField= "版本 "   HeaderText= "版本 "   SortExpression= "版本 "   />
                                <asp:TemplateField   HeaderText= "发布时间 "   SortExpression= "发布时间 ">
                                        <EditItemTemplate>
                                                <asp:TextBox   ID= "TextBox2 "   runat= "server "   Text= ' <%#   Bind( "发布时间 ")   %> '> </asp:TextBox>
                                        </EditItemTemplate>
                                        <InsertItemTemplate>
                                                <asp:TextBox   ID= "TextBox2 "   runat= "server "   Text= ' <%#   Bind( "发布时间 ")   %> '   OnTextChanged= "TextBox2_TextChanged "> </asp:TextBox>
                                                <asp:Button   ID= "Button1 "   runat= "server "   OnClick= "Button1_Click "   Text= "▼ "   ToolTip= "选择日期 "   />
                                                <asp:Calendar   ID= "Calendar1 "   runat= "server "   OnSelectionChanged= "Calendar1_SelectionChanged "   Visible= "False "   BackColor= "#FFFFCC "   BorderColor= "#FFCC66 "   BorderWidth= "1px "   DayNameFormat= "Shortest "   Font-Names= "Verdana "   Font-Size= "8pt "   ForeColor= "#663399 "   Height= "200px "   ShowGridLines= "True "   Width= "220px ">


                                                        <SelectedDayStyle   BackColor= "#CCCCFF "   Font-Bold= "True "   />
                                                        <TodayDayStyle   BackColor= "#FFCC66 "   ForeColor= "White "   />
                                                        <SelectorStyle   BackColor= "#FFCC66 "   />
                                                        <OtherMonthDayStyle   ForeColor= "#CC9966 "   />
                                                        <NextPrevStyle   Font-Size= "9pt "   ForeColor= "#FFFFCC "   />
                                                        <DayHeaderStyle   BackColor= "#FFCC66 "   Font-Bold= "True "   Height= "1px "   />
                                                        <TitleStyle   BackColor= "#990000 "   Font-Bold= "True "   Font-Size= "9pt "   ForeColor= "#FFFFCC "   />
                                                </asp:Calendar>
                                        </InsertItemTemplate>
                                        <ItemTemplate>
                                                <asp:Label   ID= "Label2 "   runat= "server "   Text= ' <%#   Bind( "发布时间 ")   %> '> </asp:Label>
                                        </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField   HeaderText= "说明 "   SortExpression= "说明 ">
                                        <EditItemTemplate>


                                                <asp:TextBox   ID= "TextBox1 "   runat= "server "   Text= ' <%#   Bind( "说明 ")   %> '> </asp:TextBox>
                                        </EditItemTemplate>
                                        <InsertItemTemplate>
                                                <asp:TextBox   ID= "TextBox1 "   runat= "server "   Text= ' <%#   Bind( "说明 ")   %> '   TextMode= "MultiLine "   Columns= "30 "   Rows= "10 "> </asp:TextBox>
                                        </InsertItemTemplate>
                                        <ItemTemplate>
                                                <asp:Label   ID= "Label1 "   runat= "server "   Text= ' <%#   Bind( "说明 ")   %> '> </asp:Label>
                                        </ItemTemplate>
                                </asp:TemplateField>
                        </Fields>
                        <HeaderStyle   HorizontalAlign= "Center "   />
                </asp:DetailsView>
                <asp:SqlDataSource   ID= "SqlDataSource1 "   runat= "server "   ConnectionString= " <%$   ConnectionStrings:LTSHPARTConnectionString2   %> "   DeleteCommand= "DELETE   FROM   [版本]   WHERE   [ID]   =   @ID "   InsertCommand= "INSERT   INTO   [版本]   ([版本],   [发布时间],   [说明])   VALUES   (@版本,   @发布时间,   @说明) "   SelectCommand= "SELECT   *   FROM   [版本]   ORDER   BY   [发布时间] "   UpdateCommand= "UPDATE   [版本]   SET   [版本]   =   @版本,   [发布时间]   =   @发布时间,   [说明]   =   @说明   WHERE   [ID]   =   @ID ">
                        <DeleteParameters>
                                <asp:Parameter   Name= "ID "   Type= "Int32 "   />
                        </DeleteParameters>


                        <UpdateParameters>
                                <asp:Parameter   Name= "版本 "   Type= "String "   />
                                <asp:Parameter   Name= "发布时间 "   Type= "DateTime "   />
                                <asp:Parameter   Name= "说明 "   Type= "String "   />
                                <asp:Parameter   Name= "ID "   Type= "Int32 "   />
                        </UpdateParameters>
                        <InsertParameters>
                                <asp:Parameter   Name= "版本 "   Type= "String "   />
                                <asp:Parameter   Name= "发布时间 "   Type= "DateTime "   />
                                <asp:Parameter   Name= "说明 "   Type= "String "   />
                        </InsertParameters>
                </asp:SqlDataSource>

在   protected   void   Calendar1_SelectionChanged(object   sender,   EventArgs   e)中
不能直接写Calendar1.SelectedDate,请教下有什么方法。

[解决办法]
DetailsView1.Rows[rowIndex].FindControl()

热点排行