日期:2014-05-18 浏览次数:20524 次
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { LinkButton linkbutton1 = sender as LinkButton ; int index = (linkbutton1.NamingContainer as GridViewRow).RowIndex; string name= GridView1.Rows[index].Cells["Name"].InnerText; }
------解决方案--------------------
LinkButton_OnClick
------解决方案--------------------
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false" DataKeyNames="ID" > <Columns> <asp:TemplateField> <ItemTemplate> <asp:LinkButton ID="LinkButton1" runat="server" AutoPostBack="true" OnClick="LinkButton_OnClick" > </ItemTemplate> </asp:TemplateField> <asp:BoundField ShowHeader="true" DataField="ID" HeaderText="ID" /> <asp:BoundField ShowHeader="true" DataField="name" HeaderText="姓名" /> </Columns> </asp:GridView> <span>评价:</span> <asp:TextBox ID="SelectedRLText" runat="server" Text=""></asp:TextBox>
------解决方案--------------------
你继承gridview自定义控件里
public event EventHandler BeforeSelectIndexchanged;
protected override void OnSelectedIndexChanged(EventArgs e)
{
BeforeSelectIndexchanged(this, EventArgs.Empty);
base.OnSelectedIndexChanged(e);
}
页面使用
this.YourGridView1.BeforeSelectIndexchanged += new EventHandler(YourGridView1_BeforeSelectIndexchanged);
或者直接在设计试图里添加事件
自定义事件参数参考http://topic.csdn.net/u/20090218/16/18d574da-71ba-42f3-88fe-821b68fb32de.html
------解决方案--------------------
on Button_OnClick
on text_change