码迷,mamicode.com
首页 > 编程语言 > 详细

GridView - javascript 触发后台 OnSelectedIndexChanged

时间:2015-09-14 10:38:46      阅读:208      评论:0      收藏:0      [点我收藏+]

标签:

1.ASPX

<asp:GridView ID="gdvDealers" runat="server" AutoGenerateColumns="False"
        CssClass="tableData" Style="margin: 0px;" OnRowDataBound="gdvDealers_RowDataBound" OnSelectedIndexChanged="xxx"

2.ASPX.cs

protected void gdvDealers_RowDataBound(object sender, GridViewRowEventArgs ev)

            if (ev.Row.RowType == DataControlRowType.DataRow)
            {
                ev.Row.Attributes["onmouseover"] = "this.style.cursor=‘hand‘;this.style.textDecoration=‘underline‘;";
                ev.Row.Attributes["onmouseout"] = "this.style.textDecoration=‘none‘;";
                for (int i = 0; i < ev.Row.Cells.Count; i++)
                {
                    if (i == 0) continue;
                    ev.Row.Cells[i].Attributes["onclick"] = ClientScript.GetPostBackClientHyperlink(this.gdvDealers, "Select$" + ev.Row.RowIndex);
                }

3. UI result

Asp.net javascript:__doPostBack(‘ctl00$MainContent$gdvDealers‘,‘Select$0‘)

GridView - javascript 触发后台 OnSelectedIndexChanged

标签:

原文地址:http://www.cnblogs.com/webglcn/p/4806448.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!