데이터grid 드롭다운 목록dropdownlist
14023 단어 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") ;
…………………………//
}
catch (Exception eSys)
{
WebUtils.ShowMessage(this.Page, " !" + eSys.Message);
}
}
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
EasyUI Datagrid Datetime(EasyUI DataGrid 시간 포맷)EasyUI DataGrid 시간 포맷 방법 1: 위에서 이러한 방법은 데이터grid에서 시험하였습니다.varobj=eval('('+'{Date: new'+value+'}'+').이 말은 도망갈 수 없다! 다음 방법...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.