Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7832141
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T12:03:45+00:00 2026-06-02T12:03:45+00:00

[ Assign a Textbox Value to the modal-box on the same page has been

  • 0

[Assign a Textbox Value to the modal-box on the same page has been answered]

NEW QUESTION:
Why the button on the modal-box didn’t get fired while I’ve clicked the button? Am I missing something?

I’ve added the code to handle the click event on the server side:

Protected Sub Save_Button_Click(sender As Object, e As System.EventArgs) Handles Save_Button.Click
    //The code goes here
End Sub

Pls see the code below with the marked line.


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 with the.

I have a gridview:

<asp:GridView ID="GV1" runat="server" DataSourceID="DS1" >
  <Columns>
    <asp:BoundField HeaderText="ID" DataField="ID"/>
    <asp:TemplateField ShowHeader="False">
      <ItemTemplate>
        <asp:LinkButton ID="Edit_Linkbutton" runat="server" CausesValidation="False" >
          <asp:Image ID="Edit_Linkbutton_Image" runat="server" ImageUrl="~/edit.png"></asp:Image>
        </asp:LinkButton>
      </ItemTemplate>
    </asp:TemplateField>
  </Columns>
</asp:GridView>

And on the same page (this is a div as modal-box to be showed after the Linkbutton on the Gridview clicked):

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

    #--------------------------------------------------------------------#
    #This button didn't get fired while clicked
    <asp:Button ID="Save_Button" runat="server" Text="Save"></asp:Button>
    #--------------------------------------------------------------------#

</div>

And then I attach a Javascript function to the LinkButton through code-behind:

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;")
Next

Rows(i).Cells(0) is the first column on the Gridview, it is “ID“.

The Javascript code is on the same page as the Gridview code:

<script>
function shopModalPopup(id){
//show the modal-box
    $("#dialog-form").dialog("open");
    // ---> How to assign the 'id' value to the Textbox1 on the modalbox?
} 

$(function () {
    $("#dialog-form").dialog({
        autoOpen: false,
        height: 300,
        width: 350,
        modal: true
    });
});
</script>

The code above do open the modal-box but not assign the value to the Textbox1 on the modal-box.

What I am gonna ask is how to assign the Id value to the Textbox1 on the modal-box? I have try to search any relevant article but they do separate the modal-box onto the other page. But in this case, the modal-box is on the same page as the Linkbutton clicked. How can I do that? Thank you very much.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T12:03:51+00:00Added an answer on June 2, 2026 at 12:03 pm

    not tested but should work.

    i think you can also avoid to use inline js and just bind the click event of the buttonLink

    #dialog-form { display:none } /* CSS */
    
    <script>  /* JS */
    /* Assuming all dialogs share the same default Settings in this grid scenario */
    var grid_modal_options = {
            height: 300,
            width: 350,
            modal: true
    };
    function shopModalPopup(id){
        var DataField = id;
        grid_modal_options.open = function(){
            $('#dialog-form #Textbox1').val( DataField );
            // OR
            // $('#dialog-form').find('textarea').val( DataField );
        };
    
        $("#dialog-form").dialog(grid_modal_options);
    } 
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can i get the second list item value and assign to the textbox.For
Cannot assign a null value via a TextBox Binding to Int32?. If the TextBox
How can I get the value of textbox into label when I click on
How can I assign a row number as a value of the textbox? I
How to get the textbox value on code-behind after the textbox value assigned on
How do I assign the value of a textbox to a variable? Here is
I am trying to get a value fro query string and assign that value
How can I assign values of the textbox to the datagridview cell ?
To assign specific value to 1D array I'm using LINQ like so: int[] nums
When,i try to assign null value to my pointer,it sometimes crashes on that line.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.