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

A

AAaron123

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
 
S

Scott M.

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
 
G

Gregory A. Beamer

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,
 
A

AAaron123

AAaron123 said:
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
 
A

AAaron123

Gregory said:
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,990
Messages
2,570,211
Members
46,796
Latest member
SteveBreed

Latest Threads

Top