English 中文(简体)
Sorting Gridview Diss ModalPopUp in GridView
原标题:Sorting Gridview breaks ModalPopUp in GridView

我有一张电网,把叫做“模式流行”和文字箱的布道连接起来。 我正试图对电网进行分类,但是,如果说(!ispostback)的话,我需要分类,防止电梯出现。 它还没有在网格中打上文字箱。 是否有办法在不使用上页上背后进行分类?

这里是配制模式、电网格和分类法。

protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            ViewState["sortOrder"] = "";
            Bind_Gridview("", "");
            loadModals();
        }
    }
protected void viewModal(object sender, EventArgs e)
{
...
     mainPanel.Controls.Add(exstModal);
        mainPanel.Controls.Add(exstModalBox);
        exstModalBox.Show();
}

protected void GridView1_Sorting(object sender, GridViewSortEventArgs e)
    {
        Bind_Gridview(e.SortExpression, sortOrder);
    }

public string sortOrder
    {
        get
        {
            if (ViewState["sortOrder"].ToString() == "desc")
            {
                ViewState["sortOrder"] = "asc";
            }
            else
            {
                ViewState["sortOrder"] = "desc";
            }

            return ViewState["sortOrder"].ToString();
        }
        set
        {
            ViewState["sortOrder"] = value;
        }
    }

protected void gv1_RowCommand(object sender, GridViewRowEventArgs e)
    {
...
CheckBox cb = new CheckBox();
        TextBox ca = new TextBox();
        ca.Width = 20;
        TextBox cga = new TextBox();
        cga.Width = 20;

if (e.Row.RowType == DataControlRowType.DataRow) //Foreach row in gridview
        {

    while (dr1.Read())
            {
                ca.Text = dr1["cyla"].ToString();
                cga.Text = dr1["cga"].ToString();
                checkText = dr1["completed"].ToString();
                if (checkText == "True")
                {
                    cb.Checked = true;
                }
                else
                {
                    cb.Checked = false;
                }
            }
...
            dr1.Close();
            conn1.Close();
            e.Row.Cells[6].Controls.Add(ca);
            e.Row.Cells[8].Controls.Add(cga);
            e.Row.Cells[9].Controls.Add(cb);
...
}
问题回答

A GridView has built-in sorting capabilities. Depending on the dataset you are using to populate the data, you likely don t need to manually handle anything manually, let alone with the ViewState.

查阅本MSDN网页上的第二例,并指出,它从来就没有与《观点》做任何手工操作的。

a>

如果你把你的代码(包括您的网页、轮pop标志和<代码>上载Modals(功能)的代码张贴在比值上,我们或许能够更好地帮助你。





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签