国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

datagrid加下拉列表dropdownlist

2019-11-17 01:37:42
字體:
來源:轉載
供稿:網友

datagrid加下拉列表dropdownlist

datagrid中代碼:

<asp:datagrid id="dgList" runat="server" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center"                                HorizontalAlign="Center" PageSize="5" AutoGenerateColumns="False" GridLines="Horizontal" CellPadding="1" BackColor="White"                                BorderWidth="1px" BorderStyle="None" BorderColor="#E7E7FF" Width=100%  OnItemDataBound="DataGrid1_ItemDataBound">                                <FooterStyle ForeColor="#4A3C8C" BackColor="#B5C7DE"></FooterStyle>                                <SelectedItemStyle Font-Bold="True" ForeColor="#F7F7F7" BackColor="#738A9C"></SelectedItemStyle>                                <AlternatingItemStyle BackColor="#F7F7F7"></AlternatingItemStyle>                                <ItemStyle HorizontalAlign="Center" ForeColor="#4A3C8C" BackColor="#E7E7FF"></ItemStyle>                                <HeaderStyle Font-Bold="True" HorizontalAlign="Center" ForeColor="#F7F7F7" BackColor="#4A3C8C"></HeaderStyle>                                <Columns>     <asp:templatecolumn HeaderText="狀態">        <itemtemplate>            <asp:dropdownlist  id="ItemDropDown" runat="server" AutoPostBack="true" OnSelectedIndexChanged="DropDown_SelectedIndexChanged"/>        </itemtemplate>    </asp:TemplateColumn>    <asp:TemplateColumn>        <ItemTemplate>            <asp:Button id="SaveButton" Visible="false" runat="server"  CommandName="save" Text="保存"></asp:Button>        </ItemTemplate>    </asp:templatecolumn>    <PagerStyle ForeColor="#4A3C8C" BackColor="#E7E7FF" Mode="NumericPages"></PagerStyle></asp:datagrid>
PRivate void InitializeComponent()        {            this.dgList.ItemCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.dgList_ItemCommand);        }  protected void DataGrid1_ItemDataBound(object sender, DataGridItemEventArgs e)        {            if (e.Item.ItemType == ListItemType.AlternatingItem ||               e.Item.ItemType == ListItemType.Item)            {                string[] options = { "", "已通知", "變更郵箱中", "聯系不上", "商戶要注銷" };                DropDownList list = (DropDownList)e.Item.FindControl("ItemDropDown");                list.DataSource = options;                list.DataBind();                TableCell cell = list.Parent as TableCell;                DataGridItem item = cell.Parent as DataGridItem;                int index = item.ItemIndex;                list.SelectedValue = item.Cells[1].Text;            }        }         protected void DropDown_SelectedIndexChanged(object sender, EventArgs e)        {            DropDownList list = (DropDownList)sender;            TableCell cell = list.Parent as TableCell;            DataGridItem item = cell.Parent as DataGridItem;            int index = item.ItemIndex;            string content = item.Cells[12].Text;           // DropDownList down = (DropDownList)item.FindControl("ItemDropDown");            string checkState = list.SelectedValue.Trim();            object obj = item.Cells[13].FindControl("queryButton");            if (obj != null)            {                Button lb = (Button)obj;                lb.Visible = true;//動下拉列表就顯示保存按鈕            }        }         private void dgList_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)        {            string spid = e.Item.Cells[2].Text.Trim();            string crt_etime = e.Item.Cells[8].Text.Trim();            string state = e.Item.Cells[12].Text.Trim();                      try            {                if (e.CommandName == "save") ;                &hellip;………………………//保存            }            catch (Exception eSys)            {                WebUtils.ShowMessage(this.Page, "保存數據失??!" + eSys.Message);            }        }


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 金塔县| 黑水县| 华池县| 昭苏县| 卢湾区| 安丘市| 光泽县| 甘洛县| 巧家县| 开鲁县| 孝义市| 大同县| 息烽县| 巨野县| 通州市| 启东市| 布尔津县| 如皋市| 外汇| 石门县| 江城| 林州市| 丽江市| 昌都县| 新晃| 手机| 扎鲁特旗| 富锦市| 新宁县| 应城市| 延津县| 曲阳县| 玉田县| 敦煌市| 鹰潭市| 苍山县| 白沙| 娱乐| 香河县| 彰武县| 白水县|