Hi there,
OK - So I have run into a problem. I have created a shopping cart, the cart is an object that gets created when the user logs in. That all works great. My problem is this.
I have a page for viewing the cart, what I want to do is loop through the cart and show the details for all the items. I mean I could just bind it to a datagrid view (I think) but I would like a little more control over that. The problem is if I loop through my array and say print some HTML it prints it first thing on the page :( That of course doesn't work... How can I get it to put my HTML where I want it? Like inside of a DIV tag?
Being a total newb to ASP programming I am not sure what the best approach to something like this is. But there has to be a lot of cases where a web page has some sort of object of varying length and it needs to be printed to the page in some fashion.
Can anyone point me in the right direction?
ThanksPlace an asp label with runat =server within the div tag. Then send the html output to it in the code behind:
<div>
<asp:Label runat="server" id="myLabel"></asp:Label>
</div>
Then in the code behind:
myLabel.Text = ...
F
Hi there,
OK - So I have run into a problem. I have created a shopping cart, the cart is an object that gets created when the user logs in. That all works great. My problem is this.
I have a page for viewing the cart, what I want to do is loop through the cart and show the details for all the items. I mean I could just bind it to a datagrid view (I think) but I would like a little more control over that. The problem is if I loop through my array and say print some HTML it prints it first thing on the page :( That of course doesn't work... How can I get it to put my HTML where I want it? Like inside of a DIV tag?
Being a total newb to ASP programming I am not sure what the best approach to something like this is. But there has to be a lot of cases where a web page has some sort of object of varying length and it needs to be printed to the page in some fashion.
Can anyone point me in the right direction?
Thanks
That was a very fundamental ASP.NET question. Are you sure you should be creating a shopping cart? :ehh:
Because of the nature of your question, I take it you don't have a lot of knowledge of the ASP.NET controls. First thing to remember, do not use Response.Write. That's something from the classic ASP days which you should rarely ever need to use.
Tutorial:
http://www.asp.net/Tutorials/quickstart.aspx
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment