GridView事件取值操作
2007-10-22 23:23
351 查看
1.通过设置建DataKey
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
string Id = this.GridView1.SelectedDataKey.Value.ToString();
Response.Redirect("UpdateCurriculum.aspx?CId=" + Id.ToString());
}
2.GridView中CommandName的使用
protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
LinkButton LinkButton1 = (LinkButton)e.Row.FindControl("LinkButton1");
LinkButton1.CommandArgument = e.Row.RowIndex.ToString();
LinkButton LinkButton2 = (LinkButton)e.Row.FindControl("LinkButton2");
LinkButton2.CommandArgument = e.Row.RowIndex.ToString();
}
}
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "OpeanteName1")
{
int index = Convert.ToInt32(e.CommandArgument);
GridViewRow row = GridView1.Rows[index];
Response.Write(index);
}
if (e.CommandName == "OpeanteName1")
{
int index = Convert.ToInt32(e.CommandArgument);
GridViewRow row = GridView1.Rows[index];
Response.Write(index+"**");
}
}
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
string Id = this.GridView1.SelectedDataKey.Value.ToString();
Response.Redirect("UpdateCurriculum.aspx?CId=" + Id.ToString());
}
2.GridView中CommandName的使用
protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
LinkButton LinkButton1 = (LinkButton)e.Row.FindControl("LinkButton1");
LinkButton1.CommandArgument = e.Row.RowIndex.ToString();
LinkButton LinkButton2 = (LinkButton)e.Row.FindControl("LinkButton2");
LinkButton2.CommandArgument = e.Row.RowIndex.ToString();
}
}
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "OpeanteName1")
{
int index = Convert.ToInt32(e.CommandArgument);
GridViewRow row = GridView1.Rows[index];
Response.Write(index);
}
if (e.CommandName == "OpeanteName1")
{
int index = Convert.ToInt32(e.CommandArgument);
GridViewRow row = GridView1.Rows[index];
Response.Write(index+"**");
}
}
相关文章推荐
- gridview 嵌套 dropdownlist 不点编辑 直接回传进行事件操作
- 【ASP】GridView相关事件操作
- gridview嵌套listview事件冲突和xutils、handler、asyn的异步操作
- gridview单击一行取值事件
- GridView常用操作事件图文介绍
- GridView手写事件,包括取主键、取值、更新、选择、删除
- 操作GRIDVIEW控件绑定取值
- GridView基本操作事件
- GridView常用操作事件图文介绍
- GridView手写事件,包括取主键、取值、更新、选择、删除
- GridView控件RowCreated事件的操作——鼠标动作
- asp.net GridView手写事件,包括取主键、取值、更新、选择、删除
- GridView的操作:事件冲突
- 【ASP.NET】演绎GridView基本操作事件
- 【ASP】GridView相关事件操作
- GridView 操作事件绑定技巧,单元格属性绑定指定值
- GridView RowCommand事件操作Demo Code
- 在GridView里的LinkButton和绑定事件的操作
- gridview中的相关事件操作
- GridView中的RowCommand事件中的取值问题