Thursday, March 22, 2012

Maintaining the webpage values

Hi all
I have two web pages. One is order form and another is item list. I was adding one column to the asp:repeater control and suddenly one problem came. Web page could not maintain its stage. I mean when I have few items on Order form with quantities entered in asp:textbox and when I go to price form to select more items and come once again to Order form all the the previous entered quantities are gone. I use array list to bring items to orde form from pricelist form. User will enter items in the text box on the order form. This items are not part of the arraylist. Please help me.are you populating your repeater control from a database? What I would suggest, is an intermediary shopping cart table. Every time a new item is added to cart, the shopping cart table will be updated, as it will when a user changes the quantities textbox. (This is usually called by an Update button outside the repeater or datagrid) Then when you have all your ducks in a row, you go to the order form, which retrieves all info from the user's shopping cart.
Does this help any? Let me know if you need more help with it.
..::smtraber::..
i am not sure if i understood well here ... but if you mean you want to save value from one page and want to use them in a different page you need to use the Session varialble and other methodologies that will suit the situation ... if you give me simple and clear example i might suggest the way as i do not know your application and i can not predict what is the best solution will be !!
good luck!!
I have implemented my shopping cart with Session variables and array list. And it is working properly. Now is there a way to save the values that are already entered in the quantity textbox when the customer again go to the item list page to chose more items. Please help me.
it sounds that we know what is your application and know what you are doing !!!! i am not sure what you mean but i will answer based on what i understood!!!

if client chose the Qty and want to buy another item ... still you can assign a session for that to be called and altered whnever the user wants!!!!
i hope that what you mean!!
please help me as yet I ahve same problem.
can you post out the code that you have problem with ?
just the part belong to this issue

here it is: this is the code for the asp:repeator control which I use. the asp:textbox control with idtxtqtyhas the problem. this is the control which I use to enter Qty.

<asp:Repeaterid="itemgrid"runat="server">

<HeaderTemplate>

<tableclass="order-item-table-border table-fix-width">

<tdclass="order-head-prod-border col1 "

style="font-size:x-small;">

Del

</td>

<tdclass="order-head-prod-border col2">

Item #

</td>

<tdclass="order-head-prod-border col3">

Item Name

</td>

<tdclass="order-head-prod-border col4">

Qty

</td>

<tdclass="order-head-prod-border col5">

Un

</td>

<tdclass="order-head-prod-border col6">

Price

</td>

<tdclass="order-head-prod-border col7">

Disc

</td>

<tdclass="order-head-prod-border col8">

Tax

</td>

<tdclass="order-head-prod-border col9">

Amount

</td>

</HeaderTemplate>

<ItemTemplate>

<tr>

<td><asp:CheckBoxid="chk1"runat="server"/></td>

<td>

<asp:labelid="lblPinum"runat="server"

Text='<%# DataBinder.Eval(Container.DataItem,"Pinum") %>'/>

</td>

<td>

<asp:labelid="lblPiname"runat="server"

Text='<%# DataBinder.Eval(Container.DataItem,"Piname") %>'/>

</td>

<td>

<asp:TextBoxid="txtqty"runat="server"Text="0"

Width="55"class="rightalign"/>

</td>

<tdclass="centeralign">

<asp:labelid="lblPiunit"runat="server"

Text='<%# DataBinder.Eval(Container.DataItem,"Piunit") %>'/>

</td>

<tdclass="rightalign">

<asp:labelid="lblPiListPrice"runat="server"

Text='<%# DataBinder.Eval(Container.DataItem,"PiListPrice") %>'/>

</td>

<td>

<asp:TextBoxid="txtdisc"runat="server"Text="0"

Width="40px"class="rightalign"/>

</td>

<tdclass="centeralign">

<asp:LabelID="lblTax"runat="server"

Text='<%# DataBinder.Eval(Container.DataItem,"PiTaxCode") %>'/>

</td>

<tdclass="rightalign">

<asp:labelid="lblAmt"runat="server"Text="0"/>

</td>

</tr>

</ItemTemplate>

<FooterTemplate>

</table>

</FooterTemplate>

</asp:Repeater>

THIS IS THE PAGE LOAD EVENT.

void Page_Load(Object src,EventArgs e)

{

if ( !IsPostBack )

{

//getting the cart items from pricelist

ArrayList item=(ArrayList)Session["mycart"];

itemgrid.DataSource=item;

itemgrid.DataBind();

if (itemgrid.Items.Count == 0)

{

pricetab.Visible =false;

}

}
}

0 comments:

Post a Comment