Coolite GridPanel 操作之一:获取gridpanel 选中行的记录信息

  <Buttons>
                        <ext:Button ID="ButtonSelect" runat="server" Text="Select">
                            <AjaxEvents>
                                <Click OnEvent="ButtonRoleListSelect_Click">
                                    <ExtraParams>
                                        <ext:Parameter Name="Values" Value="Ext.encode(#{GropRoleList}.getRowsValues())"
                                            Mode="Raw" />
                                    </ExtraParams>
                                </Click>
                            </AjaxEvents>
                        </ext:Button>
 </Buttons>

 

事件:

 

        public void ButtonRoleListSelect_Click(object sender, AjaxEventArgs e)
        {
            string json = e.ExtraParams["Values"];
            bool addHeader = true;
            DataTable dt = new DataTable();
            StringBuilder sbstr = new StringBuilder();
            Dictionary<string, string>[] companies = JSON.Deserialize<Dictionary<string, string>[]>(json);
            foreach (Dictionary<string, string> row in companies)
            {


                if (addHeader)
                {
                    foreach (KeyValuePair<string, string> keyValuePair in row)
                    {
                        dt.Columns.Add(keyValuePair.Key);
                    }
                }
                addHeader = false;
                ArrayList list = new ArrayList();
                DataRow dr = dt.NewRow();
                foreach (KeyValuePair<string, string> keyValuePair in row)
                {

                    dr[keyValuePair.Key] = keyValuePair.Value;
                    if (dr["orgrole_id"] == dr[keyValuePair.Key])
                    {
                        sbstr.Append(keyValuePair.Value + ";");
                    }
                }
                dt.Rows.Add(dr);

            }
            if (dt.Rows.Count > 0)
            {
                try
                {
                    DC_OperationType operationtype = new DC_OperationType();
                    MSG_OrgRoleOrgMainTainRequest request = new MSG_OrgRoleOrgMainTainRequest();
                    request.orgrole_id = sbstr.ToString();
                    operationtype.DCE_OperationType = DCE_OperationType.Add;
                    request.OperationType = operationtype;
                    request.organization_id = Node_id;
                    client.OrgRoleOrgMaintain(request);

                    string JsFunction = "refreshTree(#{TreePanelOrganization})";
                    //string JsFunction = "alert('dd');";
                    //string JsFunction = "refreshTree()";
                    Coolite.Ext.Web.ScriptManager sm = Coolite.Ext.Web.ScriptManager.GetInstance(HttpContext.Current);
                    sm.AddScript(string.Format("{0};", JsFunction));
                    this.WindowNewRole.Hide();


                }
                catch (Exception ex)
                {
                    Ext.Msg.Alert("错误", "Message: " + ex.Message + ";").Show();
                }
            }


        }

 

转载于:https://www.cnblogs.com/KingStar/archive/2010/06/08/1753946.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值