当点击修改的时候,把DropDownList 动态地绑定到单元格修改,单元格的值
解决方案 »
- div 隐藏!下面代码对ma?急急
- 关于Page_Load()事件的疑问..
- 检测到无法访问的代码
- 在asp页面绑定数据
- 超高分一个CRM系统的原代码,小弟谢了.分全在这里了.
- 两个字段显示在datagrid同一列。
- 如何将信息写入到客户端指定(或由客户自己选择)的文本文件里?请各位指教呀,好长时间也没整出来
- ASP.NET 2.0 下,如何将dataReader转换成datatable
- 想问一下,就是用DataList帮定了数据之后并显示出来了,我想给每个显示出来的字段加个连接????怎么搞??
- DataList的个问题
- 依然是TREEVIEW控件,加角色权限控制显示TREEVIEW菜单
- 提示System.Security.SecurityException错误
ForeColor="#404040" GridLines="None" Width="750px" OnPageIndexChanging="PageIndexChanging"
PageSize="15" OnRowDeleting="deleteData" DataKeyNames="ID" Height="1px" AllowPaging="True"
Font-Names="宋体" OnRowUpdating="Gv_RowUpdating" BorderColor="#76BDFF" BorderStyle="Solid"
BorderWidth="1px">
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" Height="0px" />
<RowStyle BackColor="#EFF3FB" BorderWidth="1px" BorderStyle="Solid" />
<EditRowStyle BackColor="#2461BF" />
<Columns>
<asp:TemplateField HeaderText="选择">
<ItemTemplate>
<asp:CheckBox ID="select" runat="server" />
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
<HeaderStyle HorizontalAlign="Center" />
</asp:TemplateField>
<asp:BoundField HeaderText="编号" DataField="ID">
<ItemStyle Font-Size="12px" HorizontalAlign="Center" />
<HeaderStyle Font-Size="12px" HorizontalAlign="Center" />
</asp:BoundField>
<asp:BoundField HeaderText="组件名称" DataField="PC4_Name">
<ItemStyle Font-Size="12px" HorizontalAlign="Center" />
<HeaderStyle Font-Size="12px" HorizontalAlign="Center" />
</asp:BoundField>
<asp:TemplateField HeaderText="操作">
<ItemTemplate>
<asp:LinkButton ID="lbt_alter" runat="server" Text="修改" Font-Size="12px" Font-Underline="false"
ForeColor="#666666" CommandName="Update" />
<asp:LinkButton ID="bntDel" runat="server" Text="删除" OnClientClick="return confirm('确定删除数据')"
Font-Size="12px" Font-Underline="false" ForeColor="#666666" CommandName="Delete" />
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:DropDownList ID="ddl" runat="server"></asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<PagerStyle BackColor="#D7F0FF" ForeColor="#404040" HorizontalAlign="Center" Height="23px" />
<HeaderStyle BackColor="#D7F0FF" Font-Bold="True" ForeColor="#404040" Height="23px" />
<AlternatingRowStyle BackColor="White" />
<PagerTemplate>
<uc1:PageControl ID="PageControl1" runat="server" />
</PagerTemplate>
</asp:GridView> protected void Gv_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
string Id = Gv.Rows[e.RowIndex].Cells[1].Text;
LinkButton lbt_Alter = (LinkButton)Gv.Rows[e.RowIndex].Cells[3].FindControl("lbt_alter");
DropDownList ddl = (DropDownList)Gv.Rows[e.RowIndex].Cells[4].FindControl("ddl");
if (lbt_Alter.Text == "修改")
{
P1.Visible = true;
alterDataInit(Id);
lbt_Alter.Text = "保存";
lbt_Alter.ForeColor = System.Drawing.Color.Red;
lbt_Alter.Font.Bold = true;
ddl.DataSource = ProductClassProvider.Instance.GetAllProductMainClass();
ddl.DataTextField = "Pc1_Name";
ddl.DataValueField = "PC1_ID";
ddl.DataBind();
}
else
{
P1.Visible = false;
saveAlterData(Id);
lbt_Alter.Text = "修改";
bindGrid();
lbt_Alter.ForeColor = System.Drawing.Color.FromArgb(102, 102, 102);
lbt_Alter.Font.Bold = false;
JsAlert("修改成功!");
}
}
http://download.csdn.net/source/213243
ForeColor="#404040" GridLines="None" Width="750px" OnPageIndexChanging="PageIndexChanging"
PageSize="15" OnRowDeleting="deleteData" DataKeyNames="ID" Height="1px" AllowPaging="True"
Font-Names="宋体" OnRowUpdating="Gv_RowUpdating" BorderColor="#76BDFF" BorderStyle="Solid"
BorderWidth="1px">
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" Height="0px" />
<RowStyle BackColor="#EFF3FB" BorderWidth="1px" BorderStyle="Solid" />
<EditRowStyle BackColor="#2461BF" />
<Columns>
<asp:TemplateField HeaderText="选择">
<ItemTemplate>
<asp:CheckBox ID="select" runat="server" />
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
<HeaderStyle HorizontalAlign="Center" />
</asp:TemplateField>
<asp:BoundField HeaderText="编号" DataField="ID">
<ItemStyle Font-Size="12px" HorizontalAlign="Center" />
<HeaderStyle Font-Size="12px" HorizontalAlign="Center" />
</asp:BoundField>
<asp:BoundField HeaderText="组件名称" DataField="PC4_Name">
<ItemStyle Font-Size="12px" HorizontalAlign="Center" />
<HeaderStyle Font-Size="12px" HorizontalAlign="Center" />
</asp:BoundField>
<asp:TemplateField HeaderText="操作">
<ItemTemplate>
<asp:LinkButton ID="lbt_alter" runat="server" Text="修改" Font-Size="12px" Font-Underline="false"
ForeColor="#666666" CommandName="Update" />
<asp:LinkButton ID="bntDel" runat="server" Text="删除" OnClientClick="return confirm('确定删除数据')"
Font-Size="12px" Font-Underline="false" ForeColor="#666666" CommandName="Delete" />
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:Label id="lb_1" runat="server" Text="<%#Eval("P1_Name")%>">
</ItemTemplate>
<EditTemplate>
<asp:DropDownList ID="ddl" runat="server" DataSource='<%getDataSource()>%' DataTextFiled="PC1_Name" DataValueFiled="PC1_ID"> </asp:DropDownList> </EditTemplate>
</asp:TemplateField>
</Columns>
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<PagerStyle BackColor="#D7F0FF" ForeColor="#404040" HorizontalAlign="Center" Height="23px" />
<HeaderStyle BackColor="#D7F0FF" Font-Bold="True" ForeColor="#404040" Height="23px" />
<AlternatingRowStyle BackColor="White" />
<PagerTemplate>
<uc1:PageControl ID="PageControl1" runat="server" />
</PagerTemplate>
</asp:GridView>
<EditTemplate>下拉框 数据源='<%取Items列表的方法()> %'</EditTemplate> 即可.
<edititemtemplate>
<asp:DropDownList id="ddlEditFlag" runat="server" Font-Size="10pt" Width="65px" __designer:wfdid="w24" SelectedValue='<%# Eval("flag") %>'>
<asp:ListItem Selected="True">未启用</asp:ListItem>
<asp:ListItem>启用</asp:ListItem>
</asp:DropDownList>
</edititemtemplate>
<itemstyle horizontalalign="Center" width="65px" wrap="False" />
<itemtemplate>
<asp:Label id="lblFlag" runat="server" Text='<%# Bind("flag") %>' Font-Size="11pt" __designer:wfdid="w23"></asp:Label>
</itemtemplate>
</asp:TemplateField>我使用没有问题。