开发者

Bind data to a dataGrid from inside a event

I have a function that has a string with information, splits it up and then adds rows and columns to a asp.net GridView.

That is fine, but the problem is that this function is fired from an event, and then when i do :

TestGrid.DataSource = (myTable).DefaultView;
TestGrid.DataBind();

It doesnt fill the grid and display (the myTable has all the correct information)

My grid looks like:

<asp:UpdatePanel ID="UpdateTestingGrid" runat="server" UpdateMode="Conditional">
                <ContentTemplate>
                    <asp:GridView ID="TestGrid" runat开发者_Go百科="server" CssClass="pipesTbl">

                    </asp:GridView>
                </ContentTemplate>

And if i understand correctly it is something to do with that it is out of the context,

Can any one try and help with this? even to just help me with were and what to start searching google? what am i looking for?

EDIT

Hope this helps a bit

protected void progressBar_RunTask(object sender, EO.Web.ProgressTaskEventArgs e)
{       
    tester.done += new tester.PipeDoneEvtArgs(tester_Done);

    progressBar.Maximum = 100;

}

void tester_Done(double runTime)
{

    DataTable myTable = new DataTable();

    //Here i fill the myTable with rows and columns

    TestGrid.DataSource = (myTable).DefaultView;
    TestGrid.DataBind();
}


You need to invoke Update() method of UpdatePanel in order to refresh the child controls (GridView).

void tester_Done(double runTime)
{
    DataTable myTable = new DataTable();

    //Here i fill the myTable with rows and columns

    TestGrid.DataSource = (myTable).DefaultView;
    TestGrid.DataBind();
    UpdateTestingGrid.Update(); // UpdateMode must be Conditional
 }


Please edit you question to reflect that question related to essentialobjects library.

Also did you saw this Demo? Demo link

I believe that you may add hidden button into UpdateTestingGrid update panel and call __doPostBack method for this button in ClientSideOnTaskDone method of progressbar. Perform gridview databinding in click event handler of that button.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜