Is it possible to replace the following with code in Page_load event

Discussion in 'ASP .Net' started by AAaron123, Aug 10, 2009.

  1. AAaron123

    AAaron123 Guest

    Is it possible to replace the following with code in Page_load event.
    I need for it to run after something else runs in Page_Load.

    <asp:DataList runat="server" ID="DataListAll" RepeatColumns="1"
    RepeatLayout="table"

    RepeatDirection="horizontal" DataSourceID="ObjectDataSourceAll">

    <ItemTemplate>

    <%# Container.DataItem %>

    </ItemTemplate>

    </asp:DataList>

    Thanks
    AAaron123, Aug 10, 2009
    #1
    1. Advertising

  2. AAaron123

    Scott M. Guest

    You could create the control on the server and place it on the page inside
    of another contain you place on the page, but why? What do you need to do?

    -Scott

    "AAaron123" <> wrote in message
    news:%...
    > Is it possible to replace the following with code in Page_load event.
    > I need for it to run after something else runs in Page_Load.
    >
    > <asp:DataList runat="server" ID="DataListAll" RepeatColumns="1"
    > RepeatLayout="table"
    >
    > RepeatDirection="horizontal" DataSourceID="ObjectDataSourceAll">
    >
    > <ItemTemplate>
    >
    > <%# Container.DataItem %>
    >
    > </ItemTemplate>
    >
    > </asp:DataList>
    >
    > Thanks
    Scott M., Aug 10, 2009
    #2
    1. Advertising

  3. "AAaron123" <> wrote in news:#QYOzufGKHA.3888
    @TK2MSFTNGP03.phx.gbl:

    > Is it possible to replace the following with code in Page_load event.
    > I need for it to run after something else runs in Page_Load.
    >
    > <asp:DataList runat="server" ID="DataListAll" RepeatColumns="1"
    > RepeatLayout="table"
    >
    > RepeatDirection="horizontal" DataSourceID="ObjectDataSourceAll">
    >
    > <ItemTemplate>
    >
    > <%# Container.DataItem %>
    >
    > </ItemTemplate>
    >
    > </asp:DataList>
    >
    > Thanks


    You can use the DataList's binding event to add whatever you need, if
    that is a possibility.

    If not, I would suggest custom coding the list or binding it to the page
    in the Page_Load event, or similar. I am still more fond of correcting a
    DataList with the binding method.

    Without knowing what the actual problem domain is, rather than the
    problem with your attempted solution, I am shooting at fish in the dark.

    Peace and Grace,

    --
    Gregory A. Beamer
    MVP; MCP: +I, SE, SD, DBA

    Twitter: @gbworld
    Blog: http://gregorybeamer.spaces.live.com

    *******************************************
    | Think outside the box! |
    *******************************************
    Gregory A. Beamer, Aug 10, 2009
    #3
  4. AAaron123

    AAaron123 Guest

    AAaron123 wrote:
    > Is it possible to replace the following with code in Page_load event.
    > I need for it to run after something else runs in Page_Load.
    >
    > <asp:DataList runat="server" ID="DataListAll" RepeatColumns="1"
    > RepeatLayout="table"
    >
    > RepeatDirection="horizontal" DataSourceID="ObjectDataSourceAll">
    >
    > <ItemTemplate>
    >
    > <%# Container.DataItem %>
    >
    > </ItemTemplate>
    >
    > </asp:DataList>
    >

    <asp:Button ID="ButtonDeleteAll" runat="server" Text="Delete All These
    Files" />

    <asp:ObjectDataSource ID="ObjectDataSourceAll" runat="server"
    TypeName="PhotoManager"

    SelectMethod="ListImportAllDirectory"></asp:ObjectDataSource>


    I think what I'm trying to do here is a solution to the NG problem I posted
    as :
    Deleted the files but the browser still shows them

    Basically, I think what is happening is that when the button is pressed the
    click event deletes files in the folder but the DataList has already been
    filled.

    Do you concur? That is, does the sequence sound correct - Datalist filed
    first then the click event?

    So the datalist does not show the current folder contents.

    I have to admit that I could use a few more words of how to go about your
    suggestions.

    Not all the details, just more direction.



    Thanks for the replies
    AAaron123, Aug 10, 2009
    #4
  5. AAaron123

    AAaron123 Guest

    Gregory A. Beamer wrote:
    > "AAaron123" <> wrote in news:#QYOzufGKHA.3888
    > @TK2MSFTNGP03.phx.gbl:
    >
    >> Is it possible to replace the following with code in Page_load event.
    >> I need for it to run after something else runs in Page_Load.
    >>
    >> <asp:DataList runat="server" ID="DataListAll" RepeatColumns="1"
    >> RepeatLayout="table"
    >>
    >> RepeatDirection="horizontal" DataSourceID="ObjectDataSourceAll">
    >>
    >> <ItemTemplate>
    >>
    >> <%# Container.DataItem %>
    >>
    >> </ItemTemplate>
    >>
    >> </asp:DataList>
    >>
    >> Thanks

    >
    > You can use the DataList's binding event to add whatever you need, if
    > that is a possibility.

    I only see the binding event when the page is first shown. Not on the post
    backs.
    That is, not after the button is clicked.
    Maybe that is the problem rather than the sequence as I described in my
    other answer.

    Thanks


    >
    > If not, I would suggest custom coding the list or



    >binding it to the
    > page in the Page_Load event, or similar.

    This I don't understand.

    Thanks

    I am still more fond of
    > correcting a DataList with the binding method.
    >
    > Without knowing what the actual problem domain is, rather than the
    > problem with your attempted solution, I am shooting at fish in the
    > dark.
    >
    > Peace and Grace,
    >
    >
    > *******************************************
    >> Think outside the box! |

    > *******************************************
    AAaron123, Aug 11, 2009
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. bminder
    Replies:
    1
    Views:
    2,162
    nfedin
    Feb 23, 2004
  2. z. f.
    Replies:
    0
    Views:
    557
    z. f.
    Oct 19, 2004
  3. Jimmy
    Replies:
    5
    Views:
    15,274
    =?Utf-8?B?Sm9yZ2UgTCBNYXRvcyBbTUNTRC5ORVRd?=
    Apr 27, 2005
  4. rockdale
    Replies:
    1
    Views:
    655
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Nov 16, 2006
  5. mscir
    Replies:
    0
    Views:
    312
    mscir
    Oct 12, 2005
Loading...

Share This Page