One GridView and many LinkButtons (asp .net WebForms) | بلاگ

One GridView and many LinkButtons (asp .net WebForms)

تعرفه تبلیغات در سایت

آخرین مطالب

امکانات وب

Vote count: 0

I have a GridView and dynamically added LinkButton in GridView cell:

protected void TestGrid_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            foreach (var l in links)
            {
               e.Row.Cells[6].Controls.Add(l.button);
               PostBackTrigger trigger = new PostBackTrigger();
               trigger.ControlID = l.button.ID;
               UpPanel.Triggers.Add(trigger);
            }
        }
 }

Links are added, its ok, but on click on link GridView refresh and links disappears. When I delete this condition from page_load function, I have a problem whith page index changing event - GridView not refresh:

if (!IsPostBack)
{
    TestGrid.DataBind();
}

What can I do to stop links disappearing and save page index functional? And do you have a best way to add many LinkButton in one cell GridView? Thank you!

asked 21 secs ago
Natalia Ch

...
نویسنده : استخدام کار بازدید : 11 تاريخ : سه شنبه 24 بهمن 1396 ساعت: 20:57