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

  • Thread starter Thread starter AAaron123
  • Start date Start date
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
 
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
 
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! |
*******************************************
 
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
 
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
 
Back
Top