Retrieve Textbox Value From Datagrid

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bryan

    Retrieve Textbox Value From Datagrid

    Hello:

    I need to retrieve the value of a textbox control in a asp.net datagrid
    using Javascript. Can anybody help out. I believe the control clientID needs
    to be passed client side so the javascript can reference. Any idea how.
    Thanks


  • Martin Honnen

    #2
    Re: Retrieve Textbox Value From Datagrid



    Bryan wrote:

    [color=blue]
    > I need to retrieve the value of a textbox control in a asp.net datagrid
    > using Javascript. Can anybody help out. I believe the control clientID needs
    > to be passed client side so the javascript can reference. Any idea how.[/color]


    If you have an .aspx page then that has a
    <form runat="server">
    and in that form you have the datagrid. Make sure you give the form
    element a name e.g.
    <form name="formName" runat="server">
    and then you can access
    document.forms. formName.elemen ts.textboxName. value
    If the textboxes in your data grid do not have a name then you could go
    by the index e.g.
    document.forms. formName.elemen ts[index].value

    Or in newer browsers you can use the id of the textbox, you could then
    use RegisterClientS criptBlock in ASP.NET to create a global, client-side
    variable to store the id.

    --

    Martin Honnen

    Comment

    Working...