问题描述
HI,
对不起,我真的不知道怎么解释这个。我有一个包含下拉列表的Gridview,当我从下拉列表中选择一个新数据时,它应该在它附近的文本框中更新。
< asp:GridView ID = Gvtimesheetrunat =serverAllowPaging =True
AutoGenerateColumns =false
OnPageIndexChanging =GvEmployeeTimeSchedule_PageIndexChanging
OnRowCommand = GvEmployeeTimeSchedule_RowCommand1Width =985px
onrowdatabound =Gvtimesheet_RowDataBound
onselectedindexchanged =Gvtimesheet_SelectedIndexChanged>
< HeaderStyle CssClass =GridviewScrollHeader />
< rowstyle cssclass =GridviewScrollItem>
< alternatingrowstyle cssclass =GridviewScrollAlternateItem>
< pagersettings mode =NumericFirstLastnextpagetext =>>>
PageButtonCount =5位置=BottomPreviousPageText =<< />
< pagerstyle cssclass =GridviewScrollPager>
< columns> < asp:BoundField DataField =employee_idReadOnly =trueHeaderText =Employee ID>
< HeaderStyle CssClass =gridheaderbgHorizontalAlign =Center/>
< itemstyle cssclass =gridcol>
< footerstyle cssclass =gridheaderbg>
< ; asp:BoundField DataField =NameReadOnly =trueHeaderText =Name>
< HeaderStyle CssClass =gridheaderbgHorizontalAlign =Center/>
< itemstyle cssclass =gridcol>
< footerstyle cssclass =gridheaderbg>
< asp:TemplateField HeaderStyle-HorizontalAlign =LeftHeaderText =Day 1>
< itemtemplate>
< asp :Label ID =lblday1runat =serverText ='<%#Bind(day1)%>'>
< asp:TextBox ID =txtday1runat =serverText ='<%#Bind(day1)%>'Width =135px>
< asp:TextBoxWatermarkExtender ID =TextBoxWatermarkExtenderday1TargetControlID =txtday1 WatermarkText =HH:mm:ss - HH:mm:ssrunat =server>
< asp:DropDownList ID =ddllistallshiftday1runat =serverOnSelectedIndexChanged =ddllistallshiftday_SelectedIndexChanged AppendDataBoundItems =trueAutoPostBack = 真实>
ddllistallshiftday1中的下拉列表包含
ddllistallshiftday1 .Items.Add(new ListItem(0, - Select - ));
ddllistallshiftday1 .Items.Add(new ListItem(09:00:00-16:00:00,Shift1));
ddllistallshiftday1 .Items.Add(new ListItem(16:00) :00-22:00:00,Shift2));
我从数据库获得
当我选择Shift2从下拉列表相应的值应显示在文本框中txtday1
请帮帮我。
先谢谢
parithi
Sorry i dont know really how to explain this. I have Gridview that contain a dropdown list when i select a new data from the dropdown it should update in the text box near it.
<asp:GridView ID="Gvtimesheet" runat="server" AllowPaging="True"
AutoGenerateColumns="false"
OnPageIndexChanging="GvEmployeeTimeSchedule_PageIndexChanging"
OnRowCommand="GvEmployeeTimeSchedule_RowCommand1" Width="985px"
onrowdatabound="Gvtimesheet_RowDataBound"
onselectedindexchanged="Gvtimesheet_SelectedIndexChanged">
<HeaderStyle CssClass="GridviewScrollHeader" />
<rowstyle cssclass="GridviewScrollItem">
<alternatingrowstyle cssclass="GridviewScrollAlternateItem">
<pagersettings mode="NumericFirstLast" nextpagetext=">>">
PageButtonCount="5" Position="Bottom" PreviousPageText="<<" />
<pagerstyle cssclass="GridviewScrollPager">
<columns> <asp:BoundField DataField="employee_id" ReadOnly="true" HeaderText="Employee ID">
<HeaderStyle CssClass="gridheaderbg" HorizontalAlign="Center" />
<itemstyle cssclass="gridcol">
<footerstyle cssclass="gridheaderbg">
<asp:BoundField DataField="Name" ReadOnly="true" HeaderText="Name">
<HeaderStyle CssClass="gridheaderbg" HorizontalAlign="Center" />
<itemstyle cssclass="gridcol">
<footerstyle cssclass="gridheaderbg">
<asp:TemplateField HeaderStyle-HorizontalAlign="Left" HeaderText="Day 1">
<itemtemplate>
<asp:Label ID="lblday1" runat="server" Text='<%# Bind("day1") %>' >
<asp:TextBox ID="txtday1" runat="server" Text='<%# Bind("day1") %>' Width="135px" >
<asp:TextBoxWatermarkExtender ID="TextBoxWatermarkExtenderday1" TargetControlID="txtday1" WatermarkText="HH:mm:ss - HH:mm:ss" runat="server">
<asp:DropDownList ID="ddllistallshiftday1" runat="server" OnSelectedIndexChanged="ddllistallshiftday_SelectedIndexChanged" AppendDataBoundItems="true" AutoPostBack="True" >
The dropdown in ddllistallshiftday1 contains
ddllistallshiftday1 .Items.Add(new ListItem(0,"--Select--"));
ddllistallshiftday1 .Items.Add(new ListItem(09:00:00-16:00:00,"Shift1"));
ddllistallshiftday1 .Items.Add(new ListItem(16:00:00-22:00:00,"Shift2"));
Which i get From database
when i select Shift2 From dropdown The corresponding value should be displayed in Textbox txtday1
Pls Help me.
Thanks in Advance
parithi
推荐答案
这篇关于Gridview要更新的特定列数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!