Hi,
To trap the even form BtnOk in Datagid, U need to trap Datagid Event =
Name "ItemCommand".
Follow the step as below.
1) Give BtnOk CommandName let's say grdArtikelen_ BtnOk
2) Attach a Event ItemCommand to Datagrid(Event name will be =
grdArtikelen_ItemCommand)
3) Check e.CommandName if it is grdArtikelen_ BtnOk then procide with =
ur Process.
Below is the same code in C#.
-------------------------------------------------------------------------=
-------------------------------------------------------------------------=
----------------------------------------------------------------------
Sample Code Event tape for Datagrid =
grdArtikelen ItemCommand
-------------------------------------------------------------------------=
-------------------------------------------------------------------------=
----------------------------------------------------------------------
private void grdArtikelen_ItemCommand(object source, =
System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
if(e.CommandName=3D=3D"grdArtikelen_ BtnOk")
{
Response.Write("Yes U Got It :)"); =20
=
Response.Write(((TextBox)(grdArtikelen.Items[e.Item.ItemIndex].Cells[0].F=
indControl("txtQty"))).Text); // To Read TextBox Value.
// Place ur code here to Process on BtnOk Click
}
}
Hope this helps.
Thanks,
sswalia
MCSD, MCAD, OCA
[quoted text, click to view] "Remco Groot Beumer" <info@rgbplus.nl> wrote in message =
news:bodr3p$75f$1@news3.tilbu1.nb.home.nl...
> Hello,
>=20
> I'm working with a datagrid control in ASP.NET. The datagrid shows a =
list of
> products. One column shows the productnumber, one column shows the
> productname, one column shows a picture of the product and the last =
column
> shows an empty textbox with an 'OK' button.
>=20
> People can enter a quantity in the empty textbox. After clicking on =
the 'OK'
> button, the product and quantity should be added to another datagrid. =
The
> problem is that I don't know how to read the quantity. I now do this =
as
> follows (cells(5) is the template-column with the textbox, the 'OK' =
button
> triggers the SelectedIndexChanged event):
>=20
> Private Sub grdArtikelen_SelectedIndexChanged(ByVal sender As =
System.Object,
> ByVal e As System.EventArgs) Handles grdArtikelen.SelectedIndexChanged
>=20
> Dim txb As TextBox
> =3DCType(Me.grdProducts.SelectedItem.Cells(5).Controls(1), TextBox)
>=20
> Dim dblQuantity As Double
>=20
> dblQuantity =3D CType(txb.Text, Double)
>=20
> End Sub
>=20
>=20
>=20
> This code gets the right textbox, but the TEXT property is always =
empty. How
> can I get the text that has been entered in the textbox?
>=20
> Any help would be appreciated.
>=20
> Greetings,
>=20
> Remco
>=20