Click here to Skip to main content
11,705,052 members (52,801 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Javascript
Hi ,
Im creating html label using javascript. The labels are creating and showing in browser window. But i cant find the dynamically created label name using another javascript.

Note: In view source the dynamic created labels are not showing.

Here is the function that im using for creating rows(labels)

function OnButtonClick_txt_rows(sender, eventArgs) 
{
    var runat = ' runat="server";"';
    var DDL_Header_Align = $find("DDL_Header_Align");
    if (eventArgs.get_buttonType() == 2) 
    {
        var txt_rows = $find("txt_rows");
        var tbody = document.getElementById("t1").getElementsByTagName("tbody")[0];
        var row = document.createElement("TR");
        for (i = 0; i <= t1.rows[0].cells.length - 1; i++) 
        {
            var cell1 = document.createElement("TD");
            var Literal1 = document.getElementById("Literal1")
            cell1.innerHTML = '<tr><td><table ><tr><td colspan=10><div id=div_lbl_print_header' + i + 'style=text-align:' + DDL_Header_Align.get_value() + '><Label id=lbl_print_header' + i + '>' + document.getElementById("txt_Barcode_header").value + '<Label></div></td></tr>';
            cell1.innerHTML += '<tr><td colspan=10><div id=div_lbl_print_value_top' + i + '  ><Label runat ID=lbl_print_value_top' + i + ' class=' + document.getElementById("lbl_print_value_top").className + '></Label></div></td></tr>'
            cell1.innerHTML += '<tr><td colspan=10><div id=div_lbl_print_barcode' + i + '><Label runat ID=lbl_print_barcode' + i + '>' + document.getElementById("txt_Barcode_value").value + '</Label></div></td></tr>'
            cell1.innerHTML += '<tr><td colspan=10><div id=div_lbl_print_value' + i + '><font face="Free 3 of 9"><Label runat ID=lbl_print_value' + i + '>' + document.getElementById("txt_Barcode_value").value + '</Label></font></div></td></tr>'
            cell1.innerHTML += '<tr><td colspan=10><div id=div_lbl_print_Footer' + i + '><Label runat ID=lbl_print_Footer' + i + '>' + document.getElementById("txt_Barcode_Footer").value + '</Label></div></td></tr></table></td></tr>'
            Literal1.innerHTML = cell1.innerHTML
            row.appendChild(Literal1);
        }
        tbody.appendChild(row);
    }
    else 
    {
        var table = document.getElementById("t1");
        var rowCount = table.rows.length;
        if (rowCount != 1)
        table.deleteRow(rowCount - 1);
    }
}
Posted 23-Dec-11 2:05am
Edited 23-Dec-11 2:12am
v2

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Did you mean to do this:

<Label runat ID=...

shoudln't it be runat='server'?

Furthermore, should it be ID = 'my_id' (you're missing the quoites around the values)?
  Permalink  
Comments
RaisKazi at 23-Dec-11 8:30am
   
OP's comments[Moved here from Solution-2] -

Hi, Mr.John Simmons,

I too try that. Its also not coming. But the label text is displaying in browser but i couldn't find in view-source.

<Label runat ID=.
runat I declared it as var runat = ' runat="server";"';

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 609
1 OriginalGriff 439
2 Andy Lanng 215
3 CPallini 202
4 F-ES Sitecore 160
0 OriginalGriff 8,958
1 Sergey Alexandrovich Kryukov 8,276
2 CPallini 5,189
3 Maciej Los 4,726
4 Mika Wendelius 3,606


Advertise | Privacy | Mobile
Web03 | 2.8.150819.1 | Last Updated 23 Dec 2011
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100