Y&歪

朝梦想前进!
Coolite 学习之五:获取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);

            }

 

将值取出转化存到datatable中。


posted on 2010-06-09 13:11  xinyu1020  阅读(635)  评论(0编辑  收藏  举报