sugeet_s
06-10-2006, 09:50 AM
hi,
i have added a button in javascript but it dissappears when i click on another server side button when the form is post back. i want that the button doesnot dissappear.
code is as follows
<html>
<Head>
<script>
function fnButton()
{
var tbl = document.getElementById('TABLE1');
var lastRow = tbl.rows.length-1;
// if there's no header row in the table, then iteration = lastRow + 1
//var iteration = lastRow;
var row = tbl.insertRow(lastRow);
// left cell
var cell1 = row.insertCell(0);
var cell2=row.insertCell(1);
var buttonnode= document.createElement('input');
buttonnode.setAttribute('type','button');
buttonnode.setAttribute('id','lbtnNext1');
buttonnode.setAttribute('name','button');
buttonnode.setAttribute('value','Next');
buttonnode.setAttribute('runat','server');
//require this particular row to be deleted
//buttonnode.attachEvent('onclick',ShowHideDivNext);
cell1.appendChild(buttonnode);
var buttonnode1= document.createElement('input');
buttonnode1.setAttribute('type','button');
buttonnode1.setAttribute('id','lbtnPrevious1');
buttonnode1.setAttribute('name','button');
buttonnode1.setAttribute('value','Previous');
//buttonnode1.setAttribute('disabled',"disabled");
//require this particular row to be deleted
//buttonnode1.attachEvent('onclick',ShowHideDivPrevious);
cell1.appendChild(buttonnode1);
return false;
}
</script>
</head>
<body scroll="yes">
<form id="form1" runat="server" >
<%--<asp:Button ID="btn1" Visible=false runat="server" OnClick="javascript:fnCreatebutton();"></asp:button>--%>
<table id="TABLE1" runat="server" style="left: 193px; width: 256px; position: relative; top: 66px;
height: 88px" language="javascript" >
<tr id=trow1>
<td id=col1>
<asp:Label ID="lblOrigin" runat="server"
Text="Origin1"></asp:Label></td>
<td >
<aspropDownList ID="ddlOrigin1" AutoPostBack="false" OnChange="javascript:CountryListOnChange(0);" runat="server" >
</aspropDownList>
</td>
<td >
<asp:Label ID="lblDestination1" runat="server" Text="Destination1"></asp:Label>
</td>
<td>
<aspropDownList ID="ddlDestination1" OnChange="javascript:CountryListOnChange(1);" runat="server">
</aspropDownList>
</td>
</tr>
<tr >
<td >
<asp:Label ID="lblDestination2" runat="server" Text="Origin2" ></asp:Label>
</td>
<td>
<aspropDownList ID="ddlOrigin2" runat="server" AutoPostBack="false" OnChange="javascript:CountryListOnChange(2);" OnSelectedIndexChanged="ddlDestination2_SelectedIndexChanged">
</aspropDownList>
</td>
<td>
<asp:Label ID="lblDestination3" runat="server" Text="Destination2"></asp:Label></td>
<td>
<aspropDownList ID="ddlDestination2" runat="server" OnChange="javascript:CountryListOnChange(3);" >
</aspropDownList>
</td>
</tr>
<tr>
<td>
<asp:CheckBox ID="chkIsReturn" runat="server" Text="IsReturn" OnCheckedChanged="chkIsReturn_CheckedChanged1" AutoPostBack="True" style="left: 164px; position: relative; top: 12px" />
<asp:Button ID="btnAddRows" runat="server" OnClientClick = "javascript:return fnButton();" OnClick="btnAddRows_Click" Style="left: 246px;
position: relative; top: -4px" Text="AddMoreRows" Width="72px" /></td>
<td>
</td>
<td>
</td>
<td >
</td>
</tr>
</table>
<asp:Button ID="btnEarnMiles" runat="server" Style="left: 117px; position: relative; top: 172px"
Text="EarnMilesCalculator" OnClick="btnEarnMiles_Click1" />
<asp:Button ID="btnBurnMiles" runat="server" Style="left: 143px; position: relative; top: 174px"
Text="BurnMilesCalculator" OnClick="btnBurnMiles_Click" />
<asp:GridView ID="GridView1" runat="server" Style="left: 306px; position: relative;
top: 248px" Visible="False" OnSelectedIndexChanged="GridView1_SelectedIndexChanged1">
</asp:GridView>
<asp:Button ID="btnBookOnline" runat="server" Style="left: 199px; position: relative;
top:174px" Text="BookOnline" OnClick="btnBookOnline_Click" />
</form>
</body>
</html>
thanks in advance
regards
sugeet
i have added a button in javascript but it dissappears when i click on another server side button when the form is post back. i want that the button doesnot dissappear.
code is as follows
<html>
<Head>
<script>
function fnButton()
{
var tbl = document.getElementById('TABLE1');
var lastRow = tbl.rows.length-1;
// if there's no header row in the table, then iteration = lastRow + 1
//var iteration = lastRow;
var row = tbl.insertRow(lastRow);
// left cell
var cell1 = row.insertCell(0);
var cell2=row.insertCell(1);
var buttonnode= document.createElement('input');
buttonnode.setAttribute('type','button');
buttonnode.setAttribute('id','lbtnNext1');
buttonnode.setAttribute('name','button');
buttonnode.setAttribute('value','Next');
buttonnode.setAttribute('runat','server');
//require this particular row to be deleted
//buttonnode.attachEvent('onclick',ShowHideDivNext);
cell1.appendChild(buttonnode);
var buttonnode1= document.createElement('input');
buttonnode1.setAttribute('type','button');
buttonnode1.setAttribute('id','lbtnPrevious1');
buttonnode1.setAttribute('name','button');
buttonnode1.setAttribute('value','Previous');
//buttonnode1.setAttribute('disabled',"disabled");
//require this particular row to be deleted
//buttonnode1.attachEvent('onclick',ShowHideDivPrevious);
cell1.appendChild(buttonnode1);
return false;
}
</script>
</head>
<body scroll="yes">
<form id="form1" runat="server" >
<%--<asp:Button ID="btn1" Visible=false runat="server" OnClick="javascript:fnCreatebutton();"></asp:button>--%>
<table id="TABLE1" runat="server" style="left: 193px; width: 256px; position: relative; top: 66px;
height: 88px" language="javascript" >
<tr id=trow1>
<td id=col1>
<asp:Label ID="lblOrigin" runat="server"
Text="Origin1"></asp:Label></td>
<td >
<aspropDownList ID="ddlOrigin1" AutoPostBack="false" OnChange="javascript:CountryListOnChange(0);" runat="server" >
</aspropDownList>
</td>
<td >
<asp:Label ID="lblDestination1" runat="server" Text="Destination1"></asp:Label>
</td>
<td>
<aspropDownList ID="ddlDestination1" OnChange="javascript:CountryListOnChange(1);" runat="server">
</aspropDownList>
</td>
</tr>
<tr >
<td >
<asp:Label ID="lblDestination2" runat="server" Text="Origin2" ></asp:Label>
</td>
<td>
<aspropDownList ID="ddlOrigin2" runat="server" AutoPostBack="false" OnChange="javascript:CountryListOnChange(2);" OnSelectedIndexChanged="ddlDestination2_SelectedIndexChanged">
</aspropDownList>
</td>
<td>
<asp:Label ID="lblDestination3" runat="server" Text="Destination2"></asp:Label></td>
<td>
<aspropDownList ID="ddlDestination2" runat="server" OnChange="javascript:CountryListOnChange(3);" >
</aspropDownList>
</td>
</tr>
<tr>
<td>
<asp:CheckBox ID="chkIsReturn" runat="server" Text="IsReturn" OnCheckedChanged="chkIsReturn_CheckedChanged1" AutoPostBack="True" style="left: 164px; position: relative; top: 12px" />
<asp:Button ID="btnAddRows" runat="server" OnClientClick = "javascript:return fnButton();" OnClick="btnAddRows_Click" Style="left: 246px;
position: relative; top: -4px" Text="AddMoreRows" Width="72px" /></td>
<td>
</td>
<td>
</td>
<td >
</td>
</tr>
</table>
<asp:Button ID="btnEarnMiles" runat="server" Style="left: 117px; position: relative; top: 172px"
Text="EarnMilesCalculator" OnClick="btnEarnMiles_Click1" />
<asp:Button ID="btnBurnMiles" runat="server" Style="left: 143px; position: relative; top: 174px"
Text="BurnMilesCalculator" OnClick="btnBurnMiles_Click" />
<asp:GridView ID="GridView1" runat="server" Style="left: 306px; position: relative;
top: 248px" Visible="False" OnSelectedIndexChanged="GridView1_SelectedIndexChanged1">
</asp:GridView>
<asp:Button ID="btnBookOnline" runat="server" Style="left: 199px; position: relative;
top:174px" Text="BookOnline" OnClick="btnBookOnline_Click" />
</form>
</body>
</html>
thanks in advance
regards
sugeet