为什么这里的linkbutton没有click事件,但点击它会调用InsertItemTemplate界面??我知道是因为CommandName="New",但为什么New会指向InsertItemTemplate,这是FormView内置的?我已经在MSDN查过LinkButton.CommandName,但实在没看明白。
<asp:FormView
id="frmSchedule"
AllowPaging="True"
DataKeyNames="EntryDate"
DataSourceID="srcSchedule"
Runat="server">
<EmptyDataTemplate>
<asp:LinkButton
id="btnNew"
Text="Add Entry"
CommandName="New"
Runat="server" />
</EmptyDataTemplate>
.........
<InsertItemTemplate>
<asp:Label
id="lblEntry"
Text="Entry:"
AssociatedControlID="txtEntry"
Runat="server" />
<br />
<asp:TextBox
id="txtEntry"
Text='<%#Bind("Entry") %>'
TextMode="MultiLine"
Columns="40"
Rows="8"
Runat="server" />
<br />
<asp:Button id="btnInsert"
Text="Insert"
CommandName="Insert"
Runat="server" />
</InsertItemTemplate>
<asp:FormView
id="frmSchedule"
AllowPaging="True"
DataKeyNames="EntryDate"
DataSourceID="srcSchedule"
Runat="server">
<EmptyDataTemplate>
<asp:LinkButton
id="btnNew"
Text="Add Entry"
CommandName="New"
Runat="server" />
</EmptyDataTemplate>
.........
<InsertItemTemplate>
<asp:Label
id="lblEntry"
Text="Entry:"
AssociatedControlID="txtEntry"
Runat="server" />
<br />
<asp:TextBox
id="txtEntry"
Text='<%#Bind("Entry") %>'
TextMode="MultiLine"
Columns="40"
Rows="8"
Runat="server" />
<br />
<asp:Button id="btnInsert"
Text="Insert"
CommandName="Insert"
Runat="server" />
</InsertItemTemplate>
解决方案 »
- 这样做不增加资源开销吗???
- 貌似今天问的有点多了。。。。。。。最后一个
- 将一个索引传给dropdownlist,dropdownlist怎么根据索引显示相对应的text
- 文件上传问题
- 自用的一个Ajax分页类现拿出来发布,需要的进来下载哦.
- 从http://www.codeproject.com上下载的控件DropDownCheckList的用法
- [分享]我的第一个C#作品!
- 在asp.net项目中怎样选中DataGrid的某一行,并取到选中行值,假设DataGrid这有一列
- 关于文章里面带图的自动翻页疑问,asp.net(vb)
- 关于自定义ProfileBase类的问题
- 郁闷,
- 求正则表达式 ````
会调用相应的事件处理函数这是.NET框架固有的!
protected void LinkButton1_Click(object sender, EventArgs e)
{ }
虽然是超连接控件,但他也是从按钮类中派生出来的,毕竟还是有按钮的特性的!
你要说HyperLink没有Click 到是对的
bang ding