C# .NET - javascript problem - Asked By neha dhage on 10-Nov-10 06:20 AM

i want to find hiddenfield in my javascript but it is showing undefined value.

myscript is,

  <script type="text/javascript">    
       var i = document.getElementById('HiddenField4').value;
        while (i < cn) {
        photoslink[i] = cnSplit[i];
        photos[i] = b[i];
     var mygallery2 = new fadeSlideShow({

       wrapperid: "fadeshow2", //ID of blank DIV on page to house Slideshow
       dimensions: [568, 313], //width/height of gallery in pixels. Should reflect dimensions of largest image
       imagearray: [
        ["images/1.jpg", "", "", ""],
        ["images/2.jpg", "", "", ""],
        ["images/4.jpg", "", "", ""] //<--no trailing comma after very last image element!
       displaymode: { type: 'auto', pause: 2500, cycles: 0, wraparound: false },
       persist: false, //remember last viewed slide and recall within same session?
       fadeduration: 500, //transition duration (milliseconds)
       descreveal: "always",
       togglerid: "fadeshow2toggler"
Santosh Prajapati replied to neha dhage on 10-Nov-10 06:30 AM
use this script in end of the html tag. than u find hidden field value

Change you syntax - Lalitha Kumaran replied to neha dhage on 10-Nov-10 06:32 AM

Try this line to get value of Hidden Field 4


Eswaran Radhakrishnan replied to neha dhage on 10-Nov-10 06:33 AM
r u sure you assigned some value before get the value from hidden field?

Mitesh Darji replied to neha dhage on 10-Nov-10 06:34 AM
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Untitled Page</title>
    <script type="text/javascript" language="javascript">

      function MyRetornar() {
        var myId = document.getElementById("<%=HIdCab.ClientID%>"); alert(myId);

        if (myId == null) {
          return confirm('Quer retornar SEM GRAVAR a aplicação actual?');
        else {
          return true;
    <form id="form1" runat="server">
    <asp:HiddenField ID="HIdCab" runat="server" />
    <asp:Button ID="BtnRetomar" runat="server" Text="Retornar" Width="85px" OnClientClick="MyRetornar();return false;" />