Ajaxmodalpopup TextBox's --> TEXT--> GridView's TextBox

Last post 07-16-2008 12:14 AM by parthrawal. 6 replies.

Sort Posts:

  • Ajaxmodalpopup TextBox's --> TEXT--> GridView's TextBox

    06-30-2008, 9:04 AM
    • Member
      432 point Member
    • parthrawal
    • Member since 03-28-2008, 4:27 AM
    • Posts 535

     

    Hi

    I have A Problem With my javascript,

     

    ERROR: 'txtbox1' is undefine in javascript

    What i want to achieve:

    I have 1 textbox in my Gridview and i have Modalpopup, i want to transfer data from modalpopup to Gridview's Textbox like User will enter Text into modalpopup's Textbox and Text should go to Gridview's Textbox  for that i have below code:

     CODE BEHIND:

     

    For Each gvr As GridViewRow In GridView2.Rows

    'Get a programmatic reference to the CheckBox control

    'Dim cb As CheckBox = CType(gvr.FindControl("chkBox1"), CheckBox)

    'ClientScript.RegisterArrayDeclaration("CheckBoxIDs", String.Concat("'", cb.ClientID, "'"))

    'TextBox1

    Dim textbox1 As TextBox = CType(gvr.FindControl("TextBox1"), TextBox)

    ClientScript.RegisterArrayDeclaration("txtbox1IDs", String.Concat("'", textbox1.ClientID, "'"))

    'txtNotes

    Dim textboxNotes As TextBox = CType(gvr.FindControl("txtNotes"), TextBox)

    ClientScript.RegisterArrayDeclaration("txtNotesIDs", String.Concat("'", textboxNotes.ClientID, "'"))

    Dim textbox2 As TextBox = CType(gvr.FindControl("TextBox2"), TextBox)

    ClientScript.RegisterArrayDeclaration("txtbox2IDs", String.Concat("'", textbox2.ClientID, "'"))

    'txtComments

    Dim textboxComments As TextBox = CType(gvr.FindControl("txtComments"), TextBox)

    ClientScript.RegisterArrayDeclaration("txtCommentsIDs", String.Concat("'", textboxComments.ClientID, "'"))

    Next

     

     

    JAVASCRIPT:

     

    function getvalue()

    {

    var get_val_txt="";var get_val_comments="";

     

    for (var i = 0; i < txtbox1IDs.length; i++)

    {

    //for adding notes here...

    get_val_txt=document.getElementById(txtbox1IDs[i]).value;

    document.getElementById(txtNotesIDs[i]).value=get_val_txt;

     

    //for adding comments

    get_val_comments=document.getElementById(txtbox2IDs[i]).value;

    document.getElementById(txtCommentsIDs[i]).value=get_val_comments;

    }

    }

     

    Please Help REgarding this

    Parth

    Thanks
    Parth
    visit for some interesting articals at
    www.parthrawal.blogspot.com
    Mark as Answer if it helps you
  • Re: Ajaxmodalpopup TextBox's --> TEXT--> GridView's TextBox

    07-02-2008, 4:04 PM
    • Participant
      1,708 point Participant
    • mvang
    • Member since 12-27-2007, 6:59 PM
    • Mid West
    • Posts 361

    Try using the Register DataItems of the ScriptManager and then in the Javascript that is referenced by the ScriptManager you would write your code there in Javascript to do what you want it to do.

    "If you have knowledge, let others light their candles in it."
    — Margaret Fuller
  • Re: Ajaxmodalpopup TextBox's --> TEXT--> GridView's TextBox

    07-03-2008, 12:37 AM
    • Member
      432 point Member
    • parthrawal
    • Member since 03-28-2008, 4:27 AM
    • Posts 535

    Hi

    It seems you are sure about it, but sorry i am not much aware about what you are trying to say,

    please tell me with some example, if possible.

    ThanksYes

    Parth

    Thanks
    Parth
    visit for some interesting articals at
    www.parthrawal.blogspot.com
    Mark as Answer if it helps you
  • Re: Ajaxmodalpopup TextBox's --> TEXT--> GridView's TextBox

    07-09-2008, 3:51 PM
    • Participant
      1,708 point Participant
    • mvang
    • Member since 12-27-2007, 6:59 PM
    • Mid West
    • Posts 361

    Hi Parth.

    To start, place the gridview in an update panel. When the modalpopup appears, there is a textbox and two buttons - one for ok and one for cancel. When the user types whatever in the textbox and clicks ok, in code behind, you will want to update the gridview (if the data for the gridview is being populated from a database, update the gridview and then bind it again so that it refreshes.) In order for the button to work, you have to use this code

    btnok.onClientClick = string.format("postback({'0}', '{1}')", btnok.UniqueId, "")

    in javascript do:

    function postback(sender, e){

     __doPostBack(sender, e);

    }

    You must also set the CausesValidation property of the button to False. With all that set, you can then access the code behind for the button and have it asyn update the gridview.

    Hope that helps! Smile

    "If you have knowledge, let others light their candles in it."
    — Margaret Fuller
  • Re: Ajaxmodalpopup TextBox's --> TEXT--> GridView's TextBox

    07-10-2008, 12:44 AM
    Answer
    • Member
      432 point Member
    • parthrawal
    • Member since 03-28-2008, 4:27 AM
    • Posts 535

     

    Hi actually i was asking like this

    http://parthrawal.blogspot.com/2008/07/textboxs-value-to-gridviews-textbox.html

    where shown something like in the video ,actuly i have prepared it and tell me how it is working..!?

    Thanks
    Parth
    visit for some interesting articals at
    www.parthrawal.blogspot.com
    Mark as Answer if it helps you
  • Re: Ajaxmodalpopup TextBox's --> TEXT--> GridView's TextBox

    07-15-2008, 6:57 PM
    • Participant
      1,708 point Participant
    • mvang
    • Member since 12-27-2007, 6:59 PM
    • Mid West
    • Posts 361

    Oh, i see. Well, glad it worked out for you! Smile

    "If you have knowledge, let others light their candles in it."
    — Margaret Fuller
  • Re: Ajaxmodalpopup TextBox's --> TEXT--> GridView's TextBox

    07-16-2008, 12:14 AM
    • Member
      432 point Member
    • parthrawal
    • Member since 03-28-2008, 4:27 AM
    • Posts 535

     

    have you seen that post of code........is it the right approach i have taken......!!?

    please tell me if i am doing something wrong......

    Thanks
    Parth
    visit for some interesting articals at
    www.parthrawal.blogspot.com
    Mark as Answer if it helps you
Page 1 of 1 (7 items)