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 7830313
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T11:10:51+00:00 2026-06-02T11:10:51+00:00

How to get the textbox value on code-behind after the textbox value assigned on

  • 0

How to get the textbox value on code-behind after the textbox value assigned on a modal-box?

This is how the modal-box appear on the page:

<div id="dialog-form" title="Modal Box">
    <asp:TextBox ID="Textbox1" runat="server" ReadOnly="True">   
    <asp:Button ID="Save_Button" runat="server" Text="Save"></asp:Button>        
</div>

In order to assign the value on Textbox1, I attach a Javascript function to the LinkButton on a Gridview (the code not showed here) through code-behind based on the LinkButton clicked:

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“. This ID will be assigned to the Textbox1 while the Linkbutton clicked.

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

<script>
var grid_modal_options = {
                    height: 450,
                    width: 550,
                    modal: true
                };

function shopModalPopup(id) {
                    var DataField = id;
                    grid_modal_options.open = function () {
                        $('#dialog-form #Textbox1').val(DataField);
                    };

                    $("#dialog-form").dialog(grid_modal_options);
                    $("#dialog-form").parent().appendTo('form:first');
                }
</script>

When I clicked the Save Button on the modal-box, the value on the Textbox1 can’t catch on the code-behind. It always return null value. How to 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-02T11:10:53+00:00Added an answer on June 2, 2026 at 11:10 am

    please read this

    http://www.codeproject.com/Articles/37090/JQuery-UI-Dialog-with-ASP-NET-empty-post-values

    i think it might help you the problem might be that the div of dialog is moved outside the form you can solve it by using reference above or just defining another hidden input and update the hidden input with the same value

     $('#dialog-form #Textbox1').val(DataField);
     $('hiddenfield').val(DataField);
    

    and then read the value from the hidden field

    not sure if it the best answer but might work as a quick fix

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

[ Assign a Textbox Value to the modal-box on the same page has been
How to get ItemsControl display items selected Item textbox text value using MVVM pattern?
Basically I want to get the value of a textbox which is to select
How do I get to increment a textbox content after clicking on a button?
I am wondering how I can get the value from an asp.net textbox that
How can I do this in XAML: PSEUDO-CODE: <TextBox Text={Binding Password} Type=Password/> so that
This time my test code displays a TextBox and two TextBlocks. The TextBox and
How can I get the selected value from DetailsView to a textbox? So far
I get no intellisense in the following lines of code (see MyStore.CustomerID): <asp:TextBox ID=TB1
I try several ways to create a few control in an .aspx page's code-behind.

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.