SelectedIndexChange Onclick不起作用 [英] SelectedIndexChange Onclick Not Works
本文介绍了SelectedIndexChange Onclick不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有GridView,我点击选择onclick当我点击行时它正在选择一些信息,但是这个onclick正在编辑Edit Too那么你可以帮我如何在编辑表格上禁用它?
I have GridView and i make Selection onclick that when i click on row it is selecting some info but this onclick is working on Edit Too So can you help How i disable it on Edit Form?
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes["onclick"] = Page.ClientScript.GetPostBackClientHyperlink(GridView1, "Select$" + e.Row.RowIndex);
e.Row.ToolTip = "Click to select this row.";
}
protected void GridView1_SelectedIndexChanged1(object sender, EventArgs e)
{
foreach (GridViewRow row in GridView1.Rows)
{
if (row.RowIndex == GridView1.SelectedIndex) {
TABLEzemota.Visible = true;
sachvnebeli.Text = (row.FindControl("Label4") as Label).Text;
checka.Checked = (row.FindControl("CheckBox1") as CheckBox).Checked;
addState.Text = (row.FindControl("Label6") as Label).Text;
AddSach.Text = (row.FindControl("Label9") as Label).Text;
addnote.Text = (row.FindControl("Label17") as Label).Text;
}
else
{
row.BackColor = ColorTranslator.FromHtml("#FFFFFF");
row.ToolTip = "Click to select this row.";
}
}
i使用这一个
i use this one
推荐答案
+ e.Row.RowIndex);
e.Row.ToolTip = 点击选择此行。;
}
protected void GridView1_SelectedIndexChanged1(object sender, EventArgs e)
{
foreach (GridViewRow row in GridView1.Rows)
{
if (row.RowIndex == GridView1.SelectedIndex) {
TABLEzemota.Visible = true;
sachvnebeli.Text = (row.FindControl("Label4") as Label).Text;
checka.Checked = (row.FindControl("CheckBox1") as CheckBox).Checked;
addState.Text = (row.FindControl("Label6") as Label).Text;
AddSach.Text = (row.FindControl("Label9") as Label).Text;
addnote.Text = (row.FindControl("Label17") as Label).Text;
}
else
{
row.BackColor = ColorTranslator.FromHtml("#FFFFFF");
row.ToolTip = "Click to select this row.";
}
}
i使用这个
i use this one
在RowEditing
事件,删除click属性或类似的东西。尝试在RowDataBound
中执行相反的操作。
Inside theRowEditing
Event, blank out the click attribute or something like that. Try to do the reverse what you are doing inside theRowDataBound
.
这篇关于SelectedIndexChange Onclick不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文