Home/ASP.NET Forums/General ASP.NET/HTML, CSS and JavaScript/how to find gridview hidden label value from javascript

how to find gridview hidden label value from javascript [Answered]RSS

45 replies

Last post Jan 07, 2010 11:56 AM by imran_ku07

Read my blog | Twitter
Interested in Azure, ASP.NET (MVC), jQuery, WCF, EF, MS SQL, ...
Keep the forums clean: report to the moderation team!
  • mamtagupta

    mamtagupta

    Member

    328 Points

    169 Posts

    Re: how to find gridview hidden label value from javascript

    Jan 06, 2010 05:52 AM|mamtagupta|LINK

    hi kris,

    i get this file. But still i am facing one problem. Mr. Malcoms function is working well with static grid. But when i am using dynamic grid it's not showing hidden field value. I think it's finding hidden field but not getting it's value why i don't know. Will you please help me.

    if it help please click on "Mark as Answer" on this post

    Regards

    Mamta
  • XIII

    XIII

    All-Star

    188019 Points

    24564 Posts

    ASPInsiders

    Moderator

    MVP

    Re: how to find gridview hidden label value from javascript

    Jan 06, 2010 06:08 AM|XIII|LINK

    Hi,

    did you use the integrated web developer toolbar of IE8 (press F12) or firebug to debug the script and see what's inside?

    Grz, Kris.

    Read my blog | Twitter
    Interested in Azure, ASP.NET (MVC), jQuery, WCF, EF, MS SQL, ...
    Keep the forums clean: report to the moderation team!
  • mamtagupta

    mamtagupta

    Member

    328 Points

    169 Posts

    Re: how to find gridview hidden label value from javascript

    Jan 06, 2010 06:12 AM|mamtagupta|LINK

    hi kris

    I am using ie7 

    if it help please click on "Mark as Answer" on this post

    Regards

    Mamta
  • XIII

    XIII

    All-Star

    188019 Points

    24564 Posts

    ASPInsiders

    Moderator

    MVP

    Re: how to find gridview hidden label value from javascript

    Jan 06, 2010 06:19 AM|XIII|LINK

    Hi,

    mamtagupta

    I am using ie7 
     

    Install Firefox and the plugin Firebug: https://addons.mozilla.org/en-US/firefox/addon/1843. These are must have tools if you're a bit serious about web development.

    Grz, Kris.

    Read my blog | Twitter
    Interested in Azure, ASP.NET (MVC), jQuery, WCF, EF, MS SQL, ...
    Keep the forums clean: report to the moderation team!
  • mamtagupta

    mamtagupta

    Member

    328 Points

    169 Posts

    Re: how to find gridview hidden label value from javascript

    Jan 06, 2010 06:30 AM|mamtagupta|LINK

    hi kris

    i have install but i m getting same problem. now what is the next step 

    if it help please click on "Mark as Answer" on this post

    Regards

    Mamta
  • XIII

    XIII

    All-Star

    188019 Points

    24564 Posts

    ASPInsiders

    Moderator

    MVP

    Re: how to find gridview hidden label value from javascript

    Jan 06, 2010 06:35 AM|XIII|LINK

    Hi,

    mamtagupta

    i m getting same problem
     

    Did you open firebug and place a breakpoint on the line where the val() function's getting called? Then execute the functionality again and see what's inside the object, if the hidden field gets found. This is going to take some debugging from you in firebug. It's a great tool to do so but you need to put some effort in it.

    Grz, Kris.

    Read my blog | Twitter
    Interested in Azure, ASP.NET (MVC), jQuery, WCF, EF, MS SQL, ...
    Keep the forums clean: report to the moderation team!
  • malcolms

    malcolms

    All-Star

    18687 Points

    3124 Posts

    Re: how to find gridview hidden label value from javascript

    Jan 06, 2010 07:27 AM|malcolms|LINK

    Ok then you should look into jQuery's live event.  It works for current and future elements, meaning for non dynamic element, bind works, but if the data is dynamic, use live.

  • mamtagupta

    mamtagupta

    Member

    328 Points

    169 Posts

    Re: how to find gridview hidden label value from javascript

    Jan 06, 2010 07:43 AM|mamtagupta|LINK

    hi malcolms

    I don't have much experience in javascript. Will you please tell me how i can use these functions in my situation. It's urgent.

    Thanks in advance 

    if it help please click on "Mark as Answer" on this post

    Regards

    Mamta
  • malcolms

    malcolms

    All-Star

    18687 Points

    3124 Posts

    Re: how to find gridview hidden label value from javascript

    Jan 06, 2010 08:37 AM|malcolms|LINK

    I just reread one of your old posts and you said "i get this file. But still i am facing one problem. Mr. Malcoms function is working well with static grid. But when i am using dynamic grid it's not showing hidden field value. I think it's finding hidden field but not getting it's value why i don't know".

    If the table is dynamic and my code is working but not findint the hidden field, then my code is working without introducing the live event. 

  • mamtagupta

    mamtagupta

    Member

    328 Points

    169 Posts

    Re: how to find gridview hidden label value from javascript

    Jan 06, 2010 09:13 AM|mamtagupta|LINK

    hi Malcolms

    Thanks grid is dynamic not table. I also think this code should work but i don't understand why it's giving me undefined.

    It's finding grid, Checking checkbox. But why it is not finding hidden field.

    if it help please click on "Mark as Answer" on this post

    Regards

    Mamta
  • mamtagupta

    mamtagupta

    Member

    328 Points

    169 Posts

    Re: how to find gridview hidden label value from javascript

    Jan 06, 2010 09:25 AM|mamtagupta|LINK

    Hi malcolms

    Thanks for help i got my error.

    Thanks kris and malcolms

    if it help please click on "Mark as Answer" on this post

    Regards

    Mamta
  • NC01

    NC01

    All-Star

    82587 Points

    15430 Posts

    Re: how to find gridview hidden label value from javascript

    Jan 06, 2010 02:43 PM|NC01|LINK

    mamtagupta

    Hi malcolms

    Thanks for help i got my error.

    Thanks kris and malcolms

     

    It would be nice of you to post the solution.

    NC...

     

  • mamtagupta

    mamtagupta

    Member

    328 Points

    169 Posts

    Re: how to find gridview hidden label value from javascript

    Jan 07, 2010 06:30 AM|mamtagupta|LINK

     hi

    I already mark Mr. Malcolms reply as answer. I am just doing one mistake. You must take that hidden field in the checkbox template Field. I am taking it in different template field. That's why i am getting object undefiened.

    if it help please click on "Mark as Answer" on this post

    Regards

    Mamta
  • imran_ku07

    imran_ku07

    All-Star

    49240 Points

    8342 Posts

    MVP

    Re: how to find gridview hidden label value from javascript

    Jan 07, 2010 11:56 AM|imran_ku07|LINK

    how to find gridview hidden label value from javascript

    Is you really need this, make sure that only change GridView1 to your GridView Id


    var c = document.getElementsByTagName("table");
            for (var i = 0; i < c.length; i++) {
                if (c[i].id.indexOf("GridView1") > -1) {
                    var hidd = c[i].getElementsByTagName("input");
                    for (var j = 0; j < hidd.length; j++) {
                        if (hidd[j].type == "hidden")
                            alert(hidd[j].id);
                    }
                }
            }




    "And whoever is removed away from the Fire and admitted to Paradise, he indeed is successful." (The Holy Quran)
    Excellent Windows VPS Hosting
    Imran Baloch MVP, MVB, MCP, MCTS, MCPD
  • ‹ Previous Thread|Next Thread ›