单击模型弹出窗口时网格视图链接消失

时间:2018-07-07 05:44:05

标签: c# asp.net

选择某些条件后,我将绑定网格视图,但是当我再次打开模型弹出窗口并关闭而不更改任何条件时,网格视图链接将消失,并且标题设计也将消失

下面是我的代码

<ajaxToolkit:ModalPopupExtender ID="ModalBatch" runat="server" TargetControlID="hdnBatch" CancelControlID="lnkbatchcl"
            BackgroundCssClass="modalBackground" PopupControlID="PnlBatch">
        </ajaxToolkit:ModalPopupExtender>

            GridViewRow gvrow = new GridViewRow(0, 0, DataControlRowType.Header, DataControlRowState.Insert);
            DataSet ds = (DataSet)Session[SessionName];
            if (ds != null)
            {
                DataTable dt = ds.Tables["GridData"];
                if (dt != null)
                {
                    int subheaderindex = 2;
                    for (int i = 0; i < dt.Columns.Count; i++)
                    {
                        TableCell cell = new TableCell();
                        cell.Text = "";
                        if (i >= 2)
                        {

                            if (RdbLocality.SelectedItem.Text == "Location")
                            {
                                string colname = dt.Columns[subheaderindex].ColumnName.ToString();
                                if (dt.Columns[subheaderindex].ColumnName.Contains("Total Chart Audited Location"))
                                {
                                    cell.Text = colname.Replace("Total Chart Audited Location", "");
                                    cell.Text = cell.Text.Replace("Professional Fee", "Professional");
                                }

                            }
                            if (i < 14)
                                cell.ColumnSpan = 4;
                            i += 3;
                            subheaderindex += 4;


                        if (cell.Text == "")
                            cell.Attributes.Add("style", "background-color:#FFF;color:#FFF;border:1 px solid #000000");

                        cell.HorizontalAlign = HorizontalAlign.Center;

                        gvrow.Cells.Add(cell);
                        MainGrid.Controls[0].Controls.AddAt(0, gvrow);
                    }

                }
            }

0 个答案:

没有答案