Dynamic TEXTBOXES with Java Script YES/NO Dialog box

hema_mca

Newcomer
Joined
Jun 9, 2010
Messages
3
Location
India
Hi All,

I am new to ASP.NET and this forum as well.

My task is to create dynamic textboxes, I have taken a table where each row contains 5 textboxes and assigned to panel when the user press enter in the 5th textbox new row is created.

I have given id as TXT + table.row.count so the id's as follows txt1,txt2... for each column.. now my requirement is before creating new row I need to check whether last two textboxes values in the row is equal or not then I have to prompt a dialog with YES/NO options to user. I could not do in server side(VB) since the id's of textboxes are not accessible in page load method. So I worte code in javascript but here there is no confirm/alert with YES/NO Options... Please help me regarding this issue. Is there any other way to obtain the above explained?

And second requirement is when the user presses F5 in second row I need to copy the above row values to current row. Here I need to get the option whether ROW/COLUMN if he/she selects ROW then entire row to be copied otherwise single cell has to be copied.

Please Help regarding the above issues. I tried VBscript but it is not working in FIREFOX.

Regards
 
I think I am having a similar problem. I have an asp page that has c# elements and some javascript elements.

If the code is run from the local machine in debug the code works fine in IE, Firefox and Chrome. When I publish the website to the IIS Server it still works in IE and chrome, but fails to work in Firefox.

When posting to this forum adding code helps. Here is a sample of my code. I am creating a menu bar at the top with some dynamic elements. I copied the code from another website. It links to external Webpages and internal anchors.

I would try searching for why Javascript does not work for aspx in firefox. If I find anything I will post results here. Also Google is a programmers best friend.

Code:
<script type="text/javascript">
//SuckerTree Horizontal Menu (Sept 14th, 06)
//By Dynamic Drive: http://www.dynamicdrive.com/style/

var menuids=["treemenu1"] //Enter id(s) of SuckerTree UL menus, separated by commas

function buildsubmenus_horizontal()
{
    for (var i = 0; i < menuids.length; i++)
    {
        var ultags=document.getElementById(menuids[i]).getElementsByTagName("ul")

        for (var t = 0; t < ultags.length; t++)
        {
        
            if (ultags[t].parentNode.parentNode.id == menuids[i])
            { //if this is a first level submenu
                ultags[t].style.top=ultags[t].parentNode.offsetHeight+"px" //dynamically position first level submenus to be height of main menu item
                ultags[t].parentNode.getElementsByTagName("a")[0].className="mainfoldericon"
            }
            else
            { //else if this is a sub level menu (ul)
                ultags[t].style.left=ultags[t-1].getElementsByTagName("a")[0].offsetWidth+"px" //position menu to the right of menu item that activated it
                ultags[t].parentNode.getElementsByTagName("a")[0].className="subfoldericon"
            }
            
            ultags[t].parentNode.onmouseover = function()
            {
                this.getElementsByTagName("ul")[0].style.visibility="visible"
            }
            
            ultags[t].parentNode.onmouseout = function()
            {
                this.getElementsByTagName("ul")[0].style.visibility="hidden"
            }
        }
    }
}

if (window.addEventListener)
    window.addEventListener("load", buildsubmenus_horizontal, false)
else if (window.attachEvent)
    window.attachEvent("onload", buildsubmenus_horizontal)

</script>

<div class="suckertreemenu">
  <ul id="treemenu1">
    <li><a href="TyphonHome.aspx">Home</a></li>
    <li><a href="Search.aspx">Search</a></li>
    <li><a href="#Custom">Custom Data</a></li>
    <li><a href="#Laptop">Laptop</a></li>
    <li><a href="#System">System</a></li>
    <li><a href="#WiFi">WiFi</a></li>
  </ul>
  <br style="clear: left;" />
</div>

Here is the CSS stuff
Code:
/****** Sucker Tree CSS Data ******/
/*Credits: Dynamic Drive CSS Library */
/*URL: http://www.dynamicdrive.com/style/ */
.suckertreemenu ul{
margin: 0;
padding: 0;
list-style-type: none;
}

/*Top level list items*/
.suckertreemenu ul li{
position: relative;
display: inline;
float: left;
background-color: #F3F3F3; /*overall menu background color*/
}

/*Top level menu link items style*/
.suckertreemenu ul li a{
display: block;
width: 90px; /*Width of top level menu link items*/
padding: 1px 8px;
border: 1px solid black;
border-left-width: 0;
text-decoration: none;
color: navy;
}
	
/*1st sub level menu*/
.suckertreemenu ul li ul{
left: 0;
position: absolute;
top: 1em; /* no need to change, as true value set by script */
display: block;
visibility: hidden;
}

/*Sub level menu list items (undo style from Top level List Items)*/
.suckertreemenu ul li ul li{
display: list-item;
float: none;
}

/*All subsequent sub menu levels offset after 1st level sub menu */
.suckertreemenu ul li ul li ul{ 
left: 159px; /* no need to change, as true value set by script */
top: 0;
}

/* Sub level menu links style */
.suckertreemenu ul li ul li a{
display: block;
width: 160px; /*width of sub menu levels*/
color: navy;
text-decoration: none;
padding: 1px 5px;
border: 1px solid #ccc;
}

.suckertreemenu ul li a:hover{
background-color: black;
color: white;
}

/*Background image for top level menu list links */
.suckertreemenu .mainfoldericon{
background: #F3F3F3 url(media/arrow-down.gif) no-repeat center right;
}

/*Background image for subsequent level menu list links */
.suckertreemenu .subfoldericon{
background: #F3F3F3 url(media/arrow-right.gif) no-repeat center right;
}

* html p#iepara{ /*For a paragraph (if any) that immediately follows suckertree menu, add 1em top spacing between the two in IE*/
padding-top: 1em;
}
	
/* Holly Hack for IE \*/
* html .suckertreemenu ul li { float: left; height: 1%; }
* html .suckertreemenu ul li a { height: 1%; }
/* End */

EDITS: Hit post before I was ready, added css data.
 
Last edited:
Back
Top