P
postings
Hi
This is edited from post from a while back, there's still something I
need to find an answer for (boy datagrids are a headache when you first
start out doing something out of the norm eh
.
Could anybody help please? Here we go then....
In my datagrid I have a few textbox controls in an EditItemTemplate
like so:
----------------------------------------
<asp:TextBox id=txtPrice ontextchanged="txtPrice_TextChanged"
runat="server" AutoPostBack="True">
<asp:TextBox id=txtDiscount runat="server" %>'>
<asp:TextBox id=txtTotal runat="server" %>'>
----------------------------------------
I also have back end code like this:
----------------------------------------
Sub txtPrice_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs)
Dim txtPrice As TextBox = CType(sender, TextBox) 'Thanks to Scott
Mitchell for this
Dim txtDiscount As TextBox = 'Where do I get this control value?
Dim txtTotal As TextBox = 'Where do I get this control value?
End Sub
----------------------------------------
As you can see the subroutine is trigger by the ontextchanged of
txtPrice
I now need to get the values of a textbox inside the datagrid
(txtDiscount), and update the value of another textbox inside the
datagrid (txtTotal), from this same subroutine which is triggered by
autopostback (unless there is another way).
How can I get the values of these other controls from the datagrid?
(I can't use
MyDataGrid.Items(e.Item.ItemIndex).FindControl("txtDiscount") and
"sender" only passes over values from txtPrice and no other controls.
I'm stumped!).
Many thanks....!
Alex
This is edited from post from a while back, there's still something I
need to find an answer for (boy datagrids are a headache when you first
start out doing something out of the norm eh
Could anybody help please? Here we go then....
In my datagrid I have a few textbox controls in an EditItemTemplate
like so:
----------------------------------------
<asp:TextBox id=txtPrice ontextchanged="txtPrice_TextChanged"
runat="server" AutoPostBack="True">
<asp:TextBox id=txtDiscount runat="server" %>'>
<asp:TextBox id=txtTotal runat="server" %>'>
----------------------------------------
I also have back end code like this:
----------------------------------------
Sub txtPrice_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs)
Dim txtPrice As TextBox = CType(sender, TextBox) 'Thanks to Scott
Mitchell for this
Dim txtDiscount As TextBox = 'Where do I get this control value?
Dim txtTotal As TextBox = 'Where do I get this control value?
End Sub
----------------------------------------
As you can see the subroutine is trigger by the ontextchanged of
txtPrice
I now need to get the values of a textbox inside the datagrid
(txtDiscount), and update the value of another textbox inside the
datagrid (txtTotal), from this same subroutine which is triggered by
autopostback (unless there is another way).
How can I get the values of these other controls from the datagrid?
(I can't use
MyDataGrid.Items(e.Item.ItemIndex).FindControl("txtDiscount") and
"sender" only passes over values from txtPrice and no other controls.
I'm stumped!).
Many thanks....!
Alex