N
Nez
Help needed!
Hello, I have looked everywhere for a solution to my problem and
this is pretty much my last resource. I have created a table in a span
with the innerhtml command in my code behind. In this table I have
created textbox html input fields. Now I need to allow the user to
change the value in the textfield, and compare it to the old value I
have stored in a cookie.
Problem is, because the textfield was created in the code behide I
can't simple referer to it value as QTY1.text.
HTML EXAMPLE
<form id="Cart" method="post" runat="server">
<table id="border">
<table id="Body">
<TABLE id="Table1" >
<SPAN id="Span1"
runat="server"></SPAN></table></table></table>.....
with a bunch of code all around and inbetween,
CODE BEHIND
look something like this.
'==========================SomeCode
here=========================
While y <> x
y = y + 1
tempCookieName = "Item" & y
If Not Request.Cookies(tempCookieName) Is Nothing Then
Dim cItem As HttpCookie =
Request.Cookies(tempCookieName)
Dim varProductDescription As String
Dim varProductCost As Double
Dim varCategoryID As Integer
'==========================SomeCode
here=========================
SQLConnection.Open()
MyCommand.ExecuteNonQuery()
varProductDescription =
HttpUtility.HtmlDecode(MyCommand.Parameters("@Description").Value)
varProductCost = MyCommand.Parameters("@Price").Value
varProductCost = varProductCost * cItem.Values("Q")
varCategoryID =
MyCommand.Parameters("@CategoryID").Value
SQLConnection.Close()
'==========================SomeCode
here=========================
lblSubTotal.Text = String.Format("{0:###,##0.00}",
lblSubTotal.Text + varProductCost)
Span1.InnerHtml += "<TR><TD width='255'><P
align='left'><FONT face='Helvetica' color='#ff0000'>"
Span1.InnerHtml += "Cart Items</FONT></P></TD><TD
align='center' width='72'>"
Span1.InnerHtml += "<FONT face='Helvetica'
color='#ff0000'>QTY</FONT></TD><TD
align='center'>Options</TD><TD>Price</TD>"
Span1.InnerHtml += "</TR><TR><TD vAlign='top'
width='255'><A HREF='../Store/ProductDetails.aspx?ProductID=" &
cItem.Values("P") & "&CategoryID=" & varCategoryID & "&View=1'>" &
varProductDescription & "</A>"
Span1.InnerHtml += "</asp:HyperLink></TD><TD
vAlign='top' align='center' width='72'>"
Span1.InnerHtml += "<asp:TextBox id='QTY2'
ReadOnly='False' >" & cItem.Values("Q") & "</asp:TextBox></TD><TD
vAlign='top'>"
Span1.InnerHtml += "<P><A HREF='cart.aspx'>Save for
Later</A><BR><A HREF='cart.aspx?Delete=" & y & "'>Delete</A>"
Span1.InnerHtml += "</P></TD><TD vAlign='top'><P>$" &
varProductCost & "</P><br><asp:Label id='lblItem" & y & "'
runat='server' ForeColor='White'>" & y & "</asp:Label></TD></TR>"
End If
End While
'========================== SomeCode Here
=========================
Anyway, there's no problems displaying what I want, the textfields
are created and they are given a unique id of "QTY#".
I simply want to read the value that has been changed in the textfield.
Compare it to the number if used to create the text field and change
it if it is different.
I have tried everything to get this to work, tried using javascript,
Which I did get to discover the value for me but then I could not use
it to change the asp cookie, leaving me once again without a solution.
I have tried using the "Findcontrol" function but without any luck.
Anything useful is most appreciated....
Tony Philip
(e-mail address removed)
Hello, I have looked everywhere for a solution to my problem and
this is pretty much my last resource. I have created a table in a span
with the innerhtml command in my code behind. In this table I have
created textbox html input fields. Now I need to allow the user to
change the value in the textfield, and compare it to the old value I
have stored in a cookie.
Problem is, because the textfield was created in the code behide I
can't simple referer to it value as QTY1.text.
HTML EXAMPLE
<form id="Cart" method="post" runat="server">
<table id="border">
<table id="Body">
<TABLE id="Table1" >
<SPAN id="Span1"
runat="server"></SPAN></table></table></table>.....
with a bunch of code all around and inbetween,
CODE BEHIND
look something like this.
'==========================SomeCode
here=========================
While y <> x
y = y + 1
tempCookieName = "Item" & y
If Not Request.Cookies(tempCookieName) Is Nothing Then
Dim cItem As HttpCookie =
Request.Cookies(tempCookieName)
Dim varProductDescription As String
Dim varProductCost As Double
Dim varCategoryID As Integer
'==========================SomeCode
here=========================
SQLConnection.Open()
MyCommand.ExecuteNonQuery()
varProductDescription =
HttpUtility.HtmlDecode(MyCommand.Parameters("@Description").Value)
varProductCost = MyCommand.Parameters("@Price").Value
varProductCost = varProductCost * cItem.Values("Q")
varCategoryID =
MyCommand.Parameters("@CategoryID").Value
SQLConnection.Close()
'==========================SomeCode
here=========================
lblSubTotal.Text = String.Format("{0:###,##0.00}",
lblSubTotal.Text + varProductCost)
Span1.InnerHtml += "<TR><TD width='255'><P
align='left'><FONT face='Helvetica' color='#ff0000'>"
Span1.InnerHtml += "Cart Items</FONT></P></TD><TD
align='center' width='72'>"
Span1.InnerHtml += "<FONT face='Helvetica'
color='#ff0000'>QTY</FONT></TD><TD
align='center'>Options</TD><TD>Price</TD>"
Span1.InnerHtml += "</TR><TR><TD vAlign='top'
width='255'><A HREF='../Store/ProductDetails.aspx?ProductID=" &
cItem.Values("P") & "&CategoryID=" & varCategoryID & "&View=1'>" &
varProductDescription & "</A>"
Span1.InnerHtml += "</asp:HyperLink></TD><TD
vAlign='top' align='center' width='72'>"
Span1.InnerHtml += "<asp:TextBox id='QTY2'
ReadOnly='False' >" & cItem.Values("Q") & "</asp:TextBox></TD><TD
vAlign='top'>"
Span1.InnerHtml += "<P><A HREF='cart.aspx'>Save for
Later</A><BR><A HREF='cart.aspx?Delete=" & y & "'>Delete</A>"
Span1.InnerHtml += "</P></TD><TD vAlign='top'><P>$" &
varProductCost & "</P><br><asp:Label id='lblItem" & y & "'
runat='server' ForeColor='White'>" & y & "</asp:Label></TD></TR>"
End If
End While
'========================== SomeCode Here
=========================
Anyway, there's no problems displaying what I want, the textfields
are created and they are given a unique id of "QTY#".
I simply want to read the value that has been changed in the textfield.
Compare it to the number if used to create the text field and change
it if it is different.
I have tried everything to get this to work, tried using javascript,
Which I did get to discover the value for me but then I could not use
it to change the asp cookie, leaving me once again without a solution.
I have tried using the "Findcontrol" function but without any luck.
Anything useful is most appreciated....
Tony Philip
(e-mail address removed)