怎样在程序中获得 EditItemTemplate 中的内容??????? 你是想获的e.item这行的值吗可以取得e.item.cell(i)的关键字,再给sql查询一次或者取得e.item这行后,传给变量。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 tryDataGrid.Items[DataGrid.EditItemIndex] 问题是Update_Command 事件 与 Edit_Command 事件中所传的参数 e 是不同的在Update_Command 事件中 e.item 是EditItemTemplate而Edit_Command 事件中 e.item 是ItemTemplate这是不同的!现在我要在 非Update_Command 事件中得到EditItemTemplate中的内容,这该怎样做??? this.DataGrid1.EditItemIndex 是当前编辑的行e.Item.Cells[0].Text 便是当前行第一列TextBox中的值. e不同没关系.你要的不是e,而是e.Item.Index,而这是一样的 我在Datagrid中加了一个模板列,在EditItemTemplate中加了一个DropDownList我现在要实现的是当点击“修改”时,绑定DropDownList。就是修改的时候“政治面貌”下拉选择的。以下是 Html 部分<asp:DataGrid id="dgFamily" runat="server" Width="661px" AllowSorting="True" AutoGenerateColumns="False" ShowFooter="True"> <Columns> <asp:TemplateColumn SortExpression="ZZMM" HeaderText="政治面貌"> <HeaderStyle Width="100px"></HeaderStyle> <ItemTemplate> <FONT face="宋体"> <asp:Label id=Label10 runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "ZZMM") %>'> </asp:Label></FONT> </ItemTemplate> <FooterTemplate> <FONT face="宋体"> <asp:DropDownList id="DropDownList2" runat="server"></asp:DropDownList></FONT> </FooterTemplate> <EditItemTemplate> <FONT face="宋体"> <asp:DropDownList id="Dropdownlist3" runat="server"></asp:DropDownList></FONT> </EditItemTemplate> </asp:TemplateColumn> <asp:TemplateColumn> <HeaderStyle Width="40px"></HeaderStyle> <ItemTemplate> <FONT face="宋体"> <asp:LinkButton id="Linkbutton5" runat="server" CommandName="Edit">修改</asp:LinkButton></FONT> </ItemTemplate> <FooterTemplate> <FONT face="宋体"> <asp:LinkButton id="Linkbutton6" runat="server" CommandName="Add">添加</asp:LinkButton></FONT> </FooterTemplate> <EditItemTemplate> <FONT face="宋体"> <asp:LinkButton id="Linkbutton7" runat="server" CommandName="Update">更新</asp:LinkButton> <asp:LinkButton id="Linkbutton8" runat="server" CommandName="Cancel">取消</asp:LinkButton></FONT> </EditItemTemplate> </asp:TemplateColumn> </Columns> </asp:DataGrid> 虽然在Update_Command 事件中Edit_Command 事件中 e.item.ItemIndex 是一样的,但是e.item.itemType 是不一样的!!!!!Update_Command 事件中 e.item.itemType=ListItemType.EditItemEdit_Command 事件中 e.item.itemType=ListItemType.Item 如果你非要这样做的话,你可以将两个控件都放到一起,然后控制他们的Visible属性 第一步:设置EditItemIndex、设置DataSource、执行DataBind()第二步:用DataGrid1.Items[DataGrid1.EditItemIndex].FindControl来查找控件 怎么接收接受转义字符? 关于asp.net网站的问题 Gridview中 如何将列名中ID 或 编码转化为 名称显示方便?在哪个事件激发 RowDataBound对嘛? 向高手请教 win2000不能访问win2003里面的sql server?? c#程序员 请各位大侠指点啊,这个问题困扰我好几天了(关于存储过程的问题) 如何获得和操作在datalist选中的checkbox 重庆微软技术中心笔试题。 请 jackyhx 和 monkey_zeng 来领分!!! 一个页面初始化的问题! 邮件系统问题?
而Edit_Command 事件中 e.item 是ItemTemplate这是不同的!现在我要在 非Update_Command 事件中得到EditItemTemplate中的内容,这该怎样做???
e.Item.Cells[0].Text 便是当前行第一列TextBox中的值.
就是修改的时候“政治面貌”下拉选择的。以下是 Html 部分
<asp:DataGrid id="dgFamily" runat="server" Width="661px" AllowSorting="True" AutoGenerateColumns="False" ShowFooter="True">
<Columns>
<asp:TemplateColumn SortExpression="ZZMM" HeaderText="政治面貌">
<HeaderStyle Width="100px"></HeaderStyle>
<ItemTemplate>
<FONT face="宋体">
<asp:Label id=Label10 runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "ZZMM") %>'>
</asp:Label></FONT>
</ItemTemplate>
<FooterTemplate>
<FONT face="宋体">
<asp:DropDownList id="DropDownList2" runat="server"></asp:DropDownList></FONT>
</FooterTemplate>
<EditItemTemplate>
<FONT face="宋体">
<asp:DropDownList id="Dropdownlist3" runat="server"></asp:DropDownList></FONT>
</EditItemTemplate>
</asp:TemplateColumn> <asp:TemplateColumn>
<HeaderStyle Width="40px"></HeaderStyle>
<ItemTemplate>
<FONT face="宋体">
<asp:LinkButton id="Linkbutton5" runat="server" CommandName="Edit">修改</asp:LinkButton></FONT>
</ItemTemplate>
<FooterTemplate>
<FONT face="宋体">
<asp:LinkButton id="Linkbutton6" runat="server" CommandName="Add">添加</asp:LinkButton></FONT>
</FooterTemplate>
<EditItemTemplate>
<FONT face="宋体">
<asp:LinkButton id="Linkbutton7" runat="server" CommandName="Update">更新</asp:LinkButton>
<asp:LinkButton id="Linkbutton8" runat="server" CommandName="Cancel">取消</asp:LinkButton></FONT>
</EditItemTemplate>
</asp:TemplateColumn> </Columns>
</asp:DataGrid>
Edit_Command 事件中 e.item.itemType=ListItemType.Item
第二步:用DataGrid1.Items[DataGrid1.EditItemIndex].FindControl来查找控件