mrjimoy_05 0 Newbie Poster

I have the code below to show the modal-box after a LinkButton clicked. And, what I want to do is how to assign the Textbox value on the modal-box from the javascript.

I have a gridview:

<asp:GridView ID="GV1" runat="server" DataSourceID="DS1" >
        <asp:TemplateField ShowHeader="False">
                <asp:LinkButton ID="LinkButton" runat="server" CausesValidation="False" >


'Attach a Javascript funtion to the LinkButton. 
Dim myLinkButton As LinkButton
For i As Integer = 0 To GV1.Rows.Count - 1
    myLinkButton = DirectCast(GV1.Rows(i).Cells(1).FindControl("LinkButton"), LinkButton)
    myLinkButton.Attributes.Add("onclick", "shopModalPopup('" + .Rows(i).Cells(0).Text & "'); return false;") '--> Passing the value

Then the Javascript:

function shopModalPopup(id){
//show the modal-box
    // ---> How to assign the 'id' value to the Textbox1 on the modalbox?

$(function () {
        autoOpen: false,
        height: 300,
        width: 350,
        modal: true

And below is the code for the modal-box:

<div id="dialog-form" title="Modal Box">
    <input type="text" id="Textbox1" />

How to take the value passed from function to the label on the box? I've tried using document.getElementById(Textbox1).value = id; but it doesn't work and even reload the page that cause the modal-box disappear. Thank you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.