关于DataList中控件如何触发事件!(高分求助) To:lbx1979(Love Arsenal) ,能不能说清楚点。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 在代码中手工加事件,它不认识。this.lstName.SelectedIndexChanged += new System.EventHandler(this.lstName_SelectedIndexChanged);应该有其它方法,我看了,可以在DataList中可以使用Button void DataList_ItemCommand(object sender, DataListCommandEventArgs e) { if (((LinkButton)e.CommandSource).CommandName == "select") DataList1.SelectedIndex = e.Item.ItemIndex; BindList(); } 需用摸板:我用的是textbox.<EditItemTemplate><asp:TextBox id="dutypeople" runat="server" Width="88px" Text='<%# DataBinder.Eval(Container.DataItem, "dutypeople") %>'></asp:TextBox></EditItemTemplate>-----------------------------------------.csTextBox dutypeople=(TextBox)(e.Item.Cells[1].FindControl("dutypeople")); 应该是可以触发的啊。我估计你是直接引用了dropdownlist的id了,这是不行的。你可以将以下代码加到dropdownlist的处理事件中:public void index_Change(Object sender,EventArgs e) { DropDownList myDropDownList=new DropDownList(); myDropDownList=(DropDownList)sender; ...... } 代码举例:<asp:DataListid="myDataList" Runat="server" Width="100%"><ItemTemplate><TABLE cellSpacing="2" borderColorDark="#008080" cellPadding="2" width="100%" borderColorLight="#008080" border="0"><TR><TD width="15%">名称</TD><TD width="30%"><!--绑定数据--><asp:DropDownList Runat="server" ID="lstName" Width="52"></asp:DropDownList></TD></TR></TABLE></asp:DataList>想触发lstName_SelectedIndexChanged 事件,或lstName选择改变时,调用一个过程。 js 如何调用c#后台函数中的返回值 替换文本部分内容 GridView编辑事件 menu控件的问题 数据库插入失败 复合自定义控件的子控件宽度自动匹配控件的宽度? 100分求自定义DataGrid类代码示例!! asp.net(vb)怎么导出数据库中的数据到excel表格中 请问高手csdn论坛的这个实时短信是如何实现的? 急急!删除数据库中的记录在线等,急送分 向数据库中INSERT INTO 时间 DataTime.Now 大家都来看看,急需要帮助!
this.lstName.SelectedIndexChanged += new System.EventHandler(this.lstName_SelectedIndexChanged);
应该有其它方法,我看了,可以在DataList中可以使用Button
void DataList_ItemCommand(object sender, DataListCommandEventArgs e)
{
if (((LinkButton)e.CommandSource).CommandName == "select")
DataList1.SelectedIndex = e.Item.ItemIndex;
BindList();
}
<asp:TextBox id="dutypeople" runat="server" Width="88px" Text='<%# DataBinder.Eval(Container.DataItem, "dutypeople") %>'>
</asp:TextBox>
</EditItemTemplate>
-----------------------------------------
.csTextBox dutypeople=(TextBox)(e.Item.Cells[1].FindControl("dutypeople"));
我估计你是直接引用了dropdownlist的id了,这是不行的。
你可以将以下代码加到dropdownlist的处理事件中:
public void index_Change(Object sender,EventArgs e)
{
DropDownList myDropDownList=new DropDownList();
myDropDownList=(DropDownList)sender;
......
}
<asp:DataListid="myDataList" Runat="server" Width="100%">
<ItemTemplate>
<TABLE cellSpacing="2" borderColorDark="#008080" cellPadding="2" width="100%" borderColorLight="#008080" border="0">
<TR>
<TD width="15%">名称</TD>
<TD width="30%">
<!--绑定数据-->
<asp:DropDownList Runat="server" ID="lstName" Width="52">
</asp:DropDownList>
</TD>
</TR>
</TABLE>
</asp:DataList>想触发lstName_SelectedIndexChanged 事件,或lstName选择改变时,调用一个过程。