gridview单击行任意位置事件! 单击行显示隐藏的panel

时间:2022-06-23 10:52:19
gridview单击行任意位置显示panel不会!

 我知道在GridView1_RowDataBound中做单击双击事件 

代码如下:

//鼠标移动改变行的颜色,自动编号
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        //其实就是给GridView加上鼠标划过的JS
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            //当鼠标停留时更改背景色
            e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#EBFBBA'");
            //当鼠标移开时还原背景色
            e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c");

            //单击/双击 事件 

            e.Row.Attributes["ondblclick"] = String.Format("javascript:dbl_click=true;window.open('check_xx.aspx?id={0}','mainFrame');", GridView1.DataKeys[e.Row.RowIndex].Value.ToString());
            e.Row.Attributes["title"] = "双击打开详细页面";
            
            e.Row.Attributes.Add("onclick", "clickevent(this.Panel1.Visible=true)");
            
            
            //自动编号
            if (e.Row.RowIndex != -1)
            {
                int idb = e.Row.RowIndex + 1;
                e.Row.Cells[0].Text = idb.ToString();
            }
            //判断事由事项字符大于15个字后用...替代
            if ((e.Row.Cells[3].Text).Length > 10)
            {
                e.Row.Cells[3].Text = (e.Row.Cells[3].Text).Substring(0, 10) + "…";
            }
            if ((e.Row.Cells[4].Text).Length > 10)
            {
                e.Row.Cells[4].Text = (e.Row.Cells[4].Text).Substring(0, 10) + "…";
            }
            
        }


    }


我知道这句写的不对!
e.Row.Attributes.Add("onclick", "clickevent(this.Panel1.Visible=true)");  


还是应该写在GridView1_SelectedIndexChanged里?

下面这个是  点击行里的button实现的效果 
 (显示隐藏的panel,及根据gridview1行选择得到id,再根据id取得number号,再根据这个number号取得另一个数据表里的数据显示在gridview2中) 
考虑到用户操作的方便性,我是想点击行中的任意位置实现这样的效果! 


protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
    {
        this.Label2.Text = this.GridView1.SelectedValue.ToString();
        this.Panel1.Visible = true;
        
        //string number=this.GridView1.Rows[1].Cells.ToString();
        
        //this.Label3.Text = this.GridView1.Rows[1].Cells.ToString();
        
        //接收订单号
        string sql = "select * from A where id=" + this.Label2.Text;
        sms_conn.Open();
        SqlDataAdapter da = new SqlDataAdapter(sql, sms_conn);
        DataSet ds = new DataSet();
        da.Fill(ds, "A");
        DataRowView rowview = ds.Tables["A"].DefaultView[0];
        this.Label3.Text = rowview["number"].ToString();
        
        string Sql2 = "select * from checksh where num="+ "'"+this.Label3.Text+"'";
        SqlDataAdapter da2 = new SqlDataAdapter(Sql2, sms_conn);
        DataSet ds2 = new DataSet();
        try
        {
            da2.Fill(ds2, "checksh");
            GridView2.DataSource = ds2.Tables["checksh"].DefaultView;
            GridView2.DataBind();
            
        }
        catch (Exception ex)
        {
            Response.Write("数据库错误,错误原因:" + ex.Message);
            Response.End();
        }
        sms_conn.Close();
        ds.Clear();
        ds.Dispose();
        ds2.Clear();
        ds2.Dispose();

    }


附上图片
gridview单击行任意位置事件! 单击行显示隐藏的panel

24 个解决方案

#1


在你现有程序上 在GridView1_RowDataBound 事件中 加上


Button btn = e.Row.FindControl("buttonid") as Button;
if(btn!=null)
{
   e.Row.Attributes.Add("onclick", "document.getElementById('btn.ClientID').click();");
}


buttonid  就是gridview 中 button 的 id

如果你不想看到button 就设为不可见

#2


你好!谢谢!
我加进去了,可是没有反应,也没有报错!

#3


你把gridview 的行生成的html 代码贴一下

#4



<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True"
            AutoGenerateColumns="False" CssClass="Gv1" DataKeyNames="id" HorizontalAlign="Center"
            OnPageIndexChanging="GridView1_PageIndexChanging" OnRowDataBound="GridView1_RowDataBound"
            OnSorting="GridView1_Sorting" SkinID="NewSkin" ToolTip="点击进入查看详细信息!" Width="98%" OnSelectedIndexChanged="GridView1_SelectedIndexChanged">
            <Columns>
                <asp:BoundField HeaderText="编号">
                    <HeaderStyle Width="27px" />
                </asp:BoundField>
                <asp:BoundField DataField="number" HeaderText="单号">
                    <HeaderStyle Width="90px" />
                </asp:BoundField>
                <asp:BoundField DataField="A_usern" HeaderText="申请人" SortExpression="A_usern">
                    <ItemStyle Width="65px" />
                    <HeaderStyle Width="60px" />
                </asp:BoundField>
                <asp:BoundField DataField="A_th" HeaderText="申请事项" SortExpression="A_th">
                    <HeaderStyle Width="200px" />
                </asp:BoundField>
                <asp:BoundField DataField="A_why" HeaderText="申请事由" SortExpression="A_why">
                    <HeaderStyle Width="150px" />
                </asp:BoundField>
                <asp:BoundField DataField="A_mon" DataFormatString="¥{0:N2}" HeaderText="费用" SortExpression="A_mon">
                    <ItemStyle Width="60px" />
                    <HeaderStyle Width="60px" />
                </asp:BoundField>
                <asp:HyperLinkField DataNavigateUrlFields="id" DataNavigateUrlFormatString="check_xx.aspx?id={0}"
                    DataTextField="id" DataTextFormatString="进入审核" HeaderText="审核">
                    <ItemStyle Font-Bold="True" />
                    <HeaderStyle Width="60px" />
                </asp:HyperLinkField>
                <asp:TemplateField HeaderText="审核状态">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label1" runat="server"></asp:Label>
                        <asp:ImageButton ID="imgbt" runat="server" />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:ButtonField CommandName="select" Text="选择" />
                <asp:TemplateField ShowHeader="False">
                    <ItemTemplate>
                        <asp:Button ID="btxian" runat="server" CausesValidation="false" CommandName="select"
                            Text="按钮" />
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
            <SelectedRowStyle Font-Bold="True" />
        </asp:GridView>


我里面添了几个临时button的都是试一下,

#5


我晕,想看的是 生成的 html 代码,不是你自己写的

#6


顶起,又空也体验下

#7


什么意思,是打开这个页面后,产生的html源代码吗?
我比较菜!不知道是不是下面这个

<script type="text/javascript">
<!--
var theForm = document.forms['form1'];
if (!theForm) {
    theForm = document.form1;
}
function __doPostBack(eventTarget, eventArgument) {
    if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
        theForm.__EVENTTARGET.value = eventTarget;
        theForm.__EVENTARGUMENT.value = eventArgument;
        theForm.submit();
    }
}
// -->
</script>


    <table align="center" border="0" cellpadding="0" cellspacing="0" width="100%" class="table_top">
            <tr>
                <td background="image/indexbar5ye.gif" class="font-title2" height="25">
                    &nbsp;&nbsp; &gt;&gt;申请书审核
                </td>
            </tr>
        </table>
    <div>
        <table id="RadioButtonList1" border="0">
<tr>
<td><input id="RadioButtonList1_0" type="radio" name="RadioButtonList1" value="0" onclick="javascript:setTimeout('__doPostBack(\'RadioButtonList1$0\',\'\')', 0)" /><label for="RadioButtonList1_0">已审</label></td><td><input id="RadioButtonList1_1" type="radio" name="RadioButtonList1" value="1" checked="checked" /><label for="RadioButtonList1_1">未审</label></td>
</tr>
</table><div>
<table title="点击进入查看详细信息!" class="Gv1" cellspacing="0" cellpadding="0" align="Center" rules="rows" border="1" id="GridView1" style="color:#333333;font-size:8pt;width:98%;border-collapse:collapse;">
<tr class="SkinHeader" align="left" style="font-weight:bold;height:22px;">
<th scope="col" style="width:27px;">编号</th><th scope="col" style="width:90px;">单号</th><th scope="col" style="width:60px;"><a href="javascript:__doPostBack('GridView1','Sort$A_usern')" style="color:#333333;">申请人</a></th><th scope="col" style="width:200px;"><a href="javascript:__doPostBack('GridView1','Sort$A_th')" style="color:#333333;">申请事项</a></th><th scope="col" style="width:150px;"><a href="javascript:__doPostBack('GridView1','Sort$A_why')" style="color:#333333;">申请事由</a></th><th scope="col" style="width:60px;"><a href="javascript:__doPostBack('GridView1','Sort$A_mon')" style="color:#333333;">费用</a></th><th scope="col" style="width:60px;">审核</th><th scope="col">审核状态</th><th scope="col">&nbsp;</th><th scope="col">&nbsp;</th>
</tr><tr onmouseover="c=this.style.backgroundColor;this.style.backgroundColor='#EBFBBA'" onmouseout="this.style.backgroundColor=c" ondblclick="javascript:dbl_click=true;window.open('check_xx.aspx?id=14','mainFrame');" title="双击打开详细页面" onclick="document.getElementById('btn.ClientID').click();" style="color:#333333;background-color:White;">
<td>1</td><td>A090203 0002</td><td style="width:65px;">周平      </td><td>玩儿去玩儿去玩儿去玩</td><td>韦尔奇无人去玩儿去玩…</td><td style="width:60px;">¥400       </td><td style="font-weight:bold;"><a href="check_xx.aspx?id=14">进入审核</a></td><td>
                        <span id="GridView1_ctl02_Label1"></span>
                        <input type="image" name="GridView1$ctl02$imgbt" id="GridView1_ctl02_imgbt" src="" style="border-width:0px;" />
                    </td><td><a href="javascript:__doPostBack('GridView1','select$0')" style="color:#333333;">选择</a></td><td>
                        <input type="submit" name="GridView1$ctl02$btxian" value="按钮" id="GridView1_ctl02_btxian" />
                    </td>
</tr><tr onmouseover="c=this.style.backgroundColor;this.style.backgroundColor='#EBFBBA'" onmouseout="this.style.backgroundColor=c" ondblclick="javascript:dbl_click=true;window.open('check_xx.aspx?id=15','mainFrame');" title="双击打开详细页面" onclick="document.getElementById('btn.ClientID').click();" style="color:#284775;background-color:#D8EFFD;">
<td>2</td><td>A090203 0003</td><td style="width:65px;">周平      </td><td>fuytiuytiu…</td><td>ojlkjlkj</td><td style="width:60px;">¥520       </td><td style="font-weight:bold;"><a href="check_xx.aspx?id=15">进入审核</a></td><td>
                        <span id="GridView1_ctl03_Label1"></span>
                        <input type="image" name="GridView1$ctl03$imgbt" id="GridView1_ctl03_imgbt" src="" style="border-width:0px;" />
                    </td><td><a href="javascript:__doPostBack('GridView1','select$1')" style="color:#284775;">选择</a></td><td>
                        <input type="submit" name="GridView1$ctl03$btxian" value="按钮" id="GridView1_ctl03_btxian" />
                    </td>
</tr><tr onmouseover="c=this.style.backgroundColor;this.style.backgroundColor='#EBFBBA'" onmouseout="this.style.backgroundColor=c" ondblclick="javascript:dbl_click=true;window.open('check_xx.aspx?id=24','mainFrame');" title="双击打开详细页面" onclick="document.getElementById('btn.ClientID').click();" style="color:#333333;background-color:#D6F773;font-weight:bold;">
<td>3</td><td>A090226 0004</td><td style="width:65px;">徐海林    </td><td>&nbsp;</td><td>a</td><td style="width:60px;">¥          </td><td style="font-weight:bold;"><a href="check_xx.aspx?id=24">进入审核</a></td><td>
                        <span id="GridView1_ctl04_Label1"></span>
                        <input type="image" name="GridView1$ctl04$imgbt" id="GridView1_ctl04_imgbt" src="" style="border-width:0px;" />
                    </td><td><a href="javascript:__doPostBack('GridView1','select$2')" style="color:#333333;">选择</a></td><td>
                        <input type="submit" name="GridView1$ctl04$btxian" value="按钮" id="GridView1_ctl04_btxian" />
                    </td>
</tr>
</table>
</div>
        <div id="Panel1" style="width:98%;">

            <table width=100%>
                <tr>
                    <td style="width: 383px; height: 236px;" valign="top">
                        &nbsp;<span id="Label3" style="color:Red;font-weight:bold;">A090226 0004</span><br />
                        <div>
<table cellspacing="0" cellpadding="0" align="Center" rules="rows" border="1" id="GridView2" style="color:#333333;font-size:8pt;width:98%;border-collapse:collapse;">
<tr class="SkinHeader" align="left" style="font-weight:bold;height:22px;">
<th scope="col" style="width:200px;">批示</th><th scope="col" style="width:60px;">审核人</th><th scope="col" style="width:100px;">日期</th><th scope="col" style="width:80px;">同意是否</th>
</tr><tr style="color:#333333;background-color:White;">
<td>&nbsp;</td><td>angel</td><td>2009-3-17</td><td>
                                        <img id="GridView2_ctl02_Image1" src="image/no.png" style="border-width:0px;" />
                                        <span id="GridView2_ctl02_Label1">不同意</span>
                                    </td>
</tr>
</table>
</div>
                    </td>
                    <td align="left" valign="top" style="height: 236px">
                        批示:<br />
                        <textarea name="txt_ps" rows="2" cols="20" id="txt_ps" style="height:64px;width:301px;"></textarea><br />
                        <input type="submit" name="btyes" value="审核同意" id="btyes" class="button60" />
                        &nbsp;&nbsp; &nbsp;&nbsp;
                        
                        <input type="submit" name="btno" value="审核不同意" id="btno" class="button60" />
                        <img id="Image2" src="" style="border-width:0px;" /></td>
                </tr>
            </table>
        
</div>
    </div>
    
<div>

<input type="hidden" name="__VIEWSTATEENCRYPTED" id="__VIEWSTATEENCRYPTED" value="" />
<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="5yw2q0vHlRRSDbAKT0iV+OzkF2fmDQ3h0rD1fMoJREb/XxQTMxImMbbOArUHoaKZEtS9NA0Qgi0Vnts+XFn48lwvbX96nDK/h+4/vu85qbOjCgF5QWjpj9rHUGwZ0utyfi9qVdl+Hli3j+ZGS/Pz4Hw3lBE1qruq2j0vcnnnFHg=" />
</div></form>
</body>
</html>

#8



Button btn = e.Row.FindControl("buttonid") as Button;
if(btn!=null)
{
   e.Row.Attributes.Add("onclick", "document.getElementById('"+btn.ClientID+"').click();");
}

#9


好了!!!!!!

太谢谢您啦!!

#10


真是高手一看就通!

#11


MARK

#12


顺便再问您一个问题?
怎样在一个GridView里嵌套两个数据表,
先给你2个数据库,
gridview单击行任意位置事件! 单击行显示隐藏的panel
根据表1的number号得到表2的yes,
0为通过审核1为没有通过审核,
表1里没有表2的number号时,表示那个单子还没有审,
这三种情况我想分别用3个图片表示在审核状态的那个列里
gridview单击行任意位置事件! 单击行显示隐藏的panel

#13


表的数据 简单写一下

#14


gridview单击行任意位置事件! 单击行显示隐藏的panel
gridview单击行任意位置事件! 单击行显示隐藏的panel

#15


图片看不到

#16


你好!我刚才试了一下,button隐藏,就又没有那个功能了,单击gridview任意行显示panel

#17


你设置Width=0

#18


诶呀!太聪明了!
ok了!

#19


你经常在线吗?
给你我的
qq:690281231,
email:angel@ascentek.com.cn 
msn:small_cat1981@etang.com
skype:ask_angel

能给我一个你的网上联系方式吗,我好加你为好友,我还有好多问题要请教您呢!

#20


 加了 e.Row.Attributes.Add("onclick", "document.getElementById('btn.ClientID').click();");之后

 双击事件e.Row.Attributes.Add(" ondblclick",……)就 不管用

#21


玉汝于成

#22


學習一下

#23


学习

#24


该回复于2012-04-23 09:23:47被版主删除

#1


在你现有程序上 在GridView1_RowDataBound 事件中 加上


Button btn = e.Row.FindControl("buttonid") as Button;
if(btn!=null)
{
   e.Row.Attributes.Add("onclick", "document.getElementById('btn.ClientID').click();");
}


buttonid  就是gridview 中 button 的 id

如果你不想看到button 就设为不可见

#2


你好!谢谢!
我加进去了,可是没有反应,也没有报错!

#3


你把gridview 的行生成的html 代码贴一下

#4



<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True"
            AutoGenerateColumns="False" CssClass="Gv1" DataKeyNames="id" HorizontalAlign="Center"
            OnPageIndexChanging="GridView1_PageIndexChanging" OnRowDataBound="GridView1_RowDataBound"
            OnSorting="GridView1_Sorting" SkinID="NewSkin" ToolTip="点击进入查看详细信息!" Width="98%" OnSelectedIndexChanged="GridView1_SelectedIndexChanged">
            <Columns>
                <asp:BoundField HeaderText="编号">
                    <HeaderStyle Width="27px" />
                </asp:BoundField>
                <asp:BoundField DataField="number" HeaderText="单号">
                    <HeaderStyle Width="90px" />
                </asp:BoundField>
                <asp:BoundField DataField="A_usern" HeaderText="申请人" SortExpression="A_usern">
                    <ItemStyle Width="65px" />
                    <HeaderStyle Width="60px" />
                </asp:BoundField>
                <asp:BoundField DataField="A_th" HeaderText="申请事项" SortExpression="A_th">
                    <HeaderStyle Width="200px" />
                </asp:BoundField>
                <asp:BoundField DataField="A_why" HeaderText="申请事由" SortExpression="A_why">
                    <HeaderStyle Width="150px" />
                </asp:BoundField>
                <asp:BoundField DataField="A_mon" DataFormatString="¥{0:N2}" HeaderText="费用" SortExpression="A_mon">
                    <ItemStyle Width="60px" />
                    <HeaderStyle Width="60px" />
                </asp:BoundField>
                <asp:HyperLinkField DataNavigateUrlFields="id" DataNavigateUrlFormatString="check_xx.aspx?id={0}"
                    DataTextField="id" DataTextFormatString="进入审核" HeaderText="审核">
                    <ItemStyle Font-Bold="True" />
                    <HeaderStyle Width="60px" />
                </asp:HyperLinkField>
                <asp:TemplateField HeaderText="审核状态">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label1" runat="server"></asp:Label>
                        <asp:ImageButton ID="imgbt" runat="server" />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:ButtonField CommandName="select" Text="选择" />
                <asp:TemplateField ShowHeader="False">
                    <ItemTemplate>
                        <asp:Button ID="btxian" runat="server" CausesValidation="false" CommandName="select"
                            Text="按钮" />
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
            <SelectedRowStyle Font-Bold="True" />
        </asp:GridView>


我里面添了几个临时button的都是试一下,

#5


我晕,想看的是 生成的 html 代码,不是你自己写的

#6


顶起,又空也体验下

#7


什么意思,是打开这个页面后,产生的html源代码吗?
我比较菜!不知道是不是下面这个

<script type="text/javascript">
<!--
var theForm = document.forms['form1'];
if (!theForm) {
    theForm = document.form1;
}
function __doPostBack(eventTarget, eventArgument) {
    if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
        theForm.__EVENTTARGET.value = eventTarget;
        theForm.__EVENTARGUMENT.value = eventArgument;
        theForm.submit();
    }
}
// -->
</script>


    <table align="center" border="0" cellpadding="0" cellspacing="0" width="100%" class="table_top">
            <tr>
                <td background="image/indexbar5ye.gif" class="font-title2" height="25">
                    &nbsp;&nbsp; &gt;&gt;申请书审核
                </td>
            </tr>
        </table>
    <div>
        <table id="RadioButtonList1" border="0">
<tr>
<td><input id="RadioButtonList1_0" type="radio" name="RadioButtonList1" value="0" onclick="javascript:setTimeout('__doPostBack(\'RadioButtonList1$0\',\'\')', 0)" /><label for="RadioButtonList1_0">已审</label></td><td><input id="RadioButtonList1_1" type="radio" name="RadioButtonList1" value="1" checked="checked" /><label for="RadioButtonList1_1">未审</label></td>
</tr>
</table><div>
<table title="点击进入查看详细信息!" class="Gv1" cellspacing="0" cellpadding="0" align="Center" rules="rows" border="1" id="GridView1" style="color:#333333;font-size:8pt;width:98%;border-collapse:collapse;">
<tr class="SkinHeader" align="left" style="font-weight:bold;height:22px;">
<th scope="col" style="width:27px;">编号</th><th scope="col" style="width:90px;">单号</th><th scope="col" style="width:60px;"><a href="javascript:__doPostBack('GridView1','Sort$A_usern')" style="color:#333333;">申请人</a></th><th scope="col" style="width:200px;"><a href="javascript:__doPostBack('GridView1','Sort$A_th')" style="color:#333333;">申请事项</a></th><th scope="col" style="width:150px;"><a href="javascript:__doPostBack('GridView1','Sort$A_why')" style="color:#333333;">申请事由</a></th><th scope="col" style="width:60px;"><a href="javascript:__doPostBack('GridView1','Sort$A_mon')" style="color:#333333;">费用</a></th><th scope="col" style="width:60px;">审核</th><th scope="col">审核状态</th><th scope="col">&nbsp;</th><th scope="col">&nbsp;</th>
</tr><tr onmouseover="c=this.style.backgroundColor;this.style.backgroundColor='#EBFBBA'" onmouseout="this.style.backgroundColor=c" ondblclick="javascript:dbl_click=true;window.open('check_xx.aspx?id=14','mainFrame');" title="双击打开详细页面" onclick="document.getElementById('btn.ClientID').click();" style="color:#333333;background-color:White;">
<td>1</td><td>A090203 0002</td><td style="width:65px;">周平      </td><td>玩儿去玩儿去玩儿去玩</td><td>韦尔奇无人去玩儿去玩…</td><td style="width:60px;">¥400       </td><td style="font-weight:bold;"><a href="check_xx.aspx?id=14">进入审核</a></td><td>
                        <span id="GridView1_ctl02_Label1"></span>
                        <input type="image" name="GridView1$ctl02$imgbt" id="GridView1_ctl02_imgbt" src="" style="border-width:0px;" />
                    </td><td><a href="javascript:__doPostBack('GridView1','select$0')" style="color:#333333;">选择</a></td><td>
                        <input type="submit" name="GridView1$ctl02$btxian" value="按钮" id="GridView1_ctl02_btxian" />
                    </td>
</tr><tr onmouseover="c=this.style.backgroundColor;this.style.backgroundColor='#EBFBBA'" onmouseout="this.style.backgroundColor=c" ondblclick="javascript:dbl_click=true;window.open('check_xx.aspx?id=15','mainFrame');" title="双击打开详细页面" onclick="document.getElementById('btn.ClientID').click();" style="color:#284775;background-color:#D8EFFD;">
<td>2</td><td>A090203 0003</td><td style="width:65px;">周平      </td><td>fuytiuytiu…</td><td>ojlkjlkj</td><td style="width:60px;">¥520       </td><td style="font-weight:bold;"><a href="check_xx.aspx?id=15">进入审核</a></td><td>
                        <span id="GridView1_ctl03_Label1"></span>
                        <input type="image" name="GridView1$ctl03$imgbt" id="GridView1_ctl03_imgbt" src="" style="border-width:0px;" />
                    </td><td><a href="javascript:__doPostBack('GridView1','select$1')" style="color:#284775;">选择</a></td><td>
                        <input type="submit" name="GridView1$ctl03$btxian" value="按钮" id="GridView1_ctl03_btxian" />
                    </td>
</tr><tr onmouseover="c=this.style.backgroundColor;this.style.backgroundColor='#EBFBBA'" onmouseout="this.style.backgroundColor=c" ondblclick="javascript:dbl_click=true;window.open('check_xx.aspx?id=24','mainFrame');" title="双击打开详细页面" onclick="document.getElementById('btn.ClientID').click();" style="color:#333333;background-color:#D6F773;font-weight:bold;">
<td>3</td><td>A090226 0004</td><td style="width:65px;">徐海林    </td><td>&nbsp;</td><td>a</td><td style="width:60px;">¥          </td><td style="font-weight:bold;"><a href="check_xx.aspx?id=24">进入审核</a></td><td>
                        <span id="GridView1_ctl04_Label1"></span>
                        <input type="image" name="GridView1$ctl04$imgbt" id="GridView1_ctl04_imgbt" src="" style="border-width:0px;" />
                    </td><td><a href="javascript:__doPostBack('GridView1','select$2')" style="color:#333333;">选择</a></td><td>
                        <input type="submit" name="GridView1$ctl04$btxian" value="按钮" id="GridView1_ctl04_btxian" />
                    </td>
</tr>
</table>
</div>
        <div id="Panel1" style="width:98%;">

            <table width=100%>
                <tr>
                    <td style="width: 383px; height: 236px;" valign="top">
                        &nbsp;<span id="Label3" style="color:Red;font-weight:bold;">A090226 0004</span><br />
                        <div>
<table cellspacing="0" cellpadding="0" align="Center" rules="rows" border="1" id="GridView2" style="color:#333333;font-size:8pt;width:98%;border-collapse:collapse;">
<tr class="SkinHeader" align="left" style="font-weight:bold;height:22px;">
<th scope="col" style="width:200px;">批示</th><th scope="col" style="width:60px;">审核人</th><th scope="col" style="width:100px;">日期</th><th scope="col" style="width:80px;">同意是否</th>
</tr><tr style="color:#333333;background-color:White;">
<td>&nbsp;</td><td>angel</td><td>2009-3-17</td><td>
                                        <img id="GridView2_ctl02_Image1" src="image/no.png" style="border-width:0px;" />
                                        <span id="GridView2_ctl02_Label1">不同意</span>
                                    </td>
</tr>
</table>
</div>
                    </td>
                    <td align="left" valign="top" style="height: 236px">
                        批示:<br />
                        <textarea name="txt_ps" rows="2" cols="20" id="txt_ps" style="height:64px;width:301px;"></textarea><br />
                        <input type="submit" name="btyes" value="审核同意" id="btyes" class="button60" />
                        &nbsp;&nbsp; &nbsp;&nbsp;
                        
                        <input type="submit" name="btno" value="审核不同意" id="btno" class="button60" />
                        <img id="Image2" src="" style="border-width:0px;" /></td>
                </tr>
            </table>
        
</div>
    </div>
    
<div>

<input type="hidden" name="__VIEWSTATEENCRYPTED" id="__VIEWSTATEENCRYPTED" value="" />
<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="5yw2q0vHlRRSDbAKT0iV+OzkF2fmDQ3h0rD1fMoJREb/XxQTMxImMbbOArUHoaKZEtS9NA0Qgi0Vnts+XFn48lwvbX96nDK/h+4/vu85qbOjCgF5QWjpj9rHUGwZ0utyfi9qVdl+Hli3j+ZGS/Pz4Hw3lBE1qruq2j0vcnnnFHg=" />
</div></form>
</body>
</html>

#8



Button btn = e.Row.FindControl("buttonid") as Button;
if(btn!=null)
{
   e.Row.Attributes.Add("onclick", "document.getElementById('"+btn.ClientID+"').click();");
}

#9


好了!!!!!!

太谢谢您啦!!

#10


真是高手一看就通!

#11


MARK

#12


顺便再问您一个问题?
怎样在一个GridView里嵌套两个数据表,
先给你2个数据库,
gridview单击行任意位置事件! 单击行显示隐藏的panel
根据表1的number号得到表2的yes,
0为通过审核1为没有通过审核,
表1里没有表2的number号时,表示那个单子还没有审,
这三种情况我想分别用3个图片表示在审核状态的那个列里
gridview单击行任意位置事件! 单击行显示隐藏的panel

#13


表的数据 简单写一下

#14


gridview单击行任意位置事件! 单击行显示隐藏的panel
gridview单击行任意位置事件! 单击行显示隐藏的panel

#15


图片看不到

#16


你好!我刚才试了一下,button隐藏,就又没有那个功能了,单击gridview任意行显示panel

#17


你设置Width=0

#18


诶呀!太聪明了!
ok了!

#19


你经常在线吗?
给你我的
qq:690281231,
email:angel@ascentek.com.cn 
msn:small_cat1981@etang.com
skype:ask_angel

能给我一个你的网上联系方式吗,我好加你为好友,我还有好多问题要请教您呢!

#20


 加了 e.Row.Attributes.Add("onclick", "document.getElementById('btn.ClientID').click();");之后

 双击事件e.Row.Attributes.Add(" ondblclick",……)就 不管用

#21


玉汝于成

#22


學習一下

#23


学习

#24


该回复于2012-04-23 09:23:47被版主删除