Fakir Ahmet

Fakir Ahmet

  • NA
  • 2
  • 633

I can not access in the second view elements(txtB) reference

May 5 2017 11:14 AM
I can not access in the second view elements(textBoxs) reference . why it could be

<body onload="show()" >
<form id="form1" runat="server">
<div>
<asp:MultiView ID="MultiView1" runat="server">
<asp:View ID="View1" runat="server">

<table class="auto-style1">
<tr>
<td class="baslik">Adi </td>
<td>
<asp:TextBox ID="a1" runat="server" ClientIDMode="Static" Width="300px"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">Soyadi</td>
<td class="auto-style3" id="a2">
<asp:TextBox ID="a2" runat="server" ClientIDMode="Static" Width="300px"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style6">Memleket</td>
<td class="auto-style7">
<asp:TextBox ID="a3" runat="server" ClientIDMode="Static" TextMode="MultiLine" Width="300px"></asp:TextBox>
</td>
</tr>
</table>

</asp:View>
<asp:View ID="View2" runat="server">
<table class="auto-style1">
<tr>
<td class="baslik">Meslek</td>
<td>
<asp:TextBox ID="b1" runat="server" ClientIDMode="Static" Width="300px"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style4">Mezuniyet</td>
<td class="auto-style5">
<asp:TextBox ID="b2" runat="server" ClientIDMode="Static" OnTextChanged="TextBox5_TextChanged" Width="300px"></asp:TextBox>
</td>
</tr>
<tr>
<td class="baslik">Brans</td>
<td>
<asp:TextBox ID="b3" runat="server" ClientIDMode="Static" TextMode="MultiLine" Width="300px"></asp:TextBox>
</td>
</tr>
</table>
</asp:View>
</asp:MultiView>
</div>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="1. Asama" />
<asp:Button ID="Button2" runat="server" OnClick="Button2_Click" Text="2. Asama" />
</form>
</body>

Javascript code


function show() {
var txt = new Array();
var alan = ['a1','a2','a3','b1','b2','b3'];

for (var i = 0; i < alan.length; i++) {
txt[i]=document.getElementById(alan[i]);
txt[i].addEventListener("keyup", wsss, true);
}
alert(txt.length);
}
function wsss(e){

alert("Mesaj"); // this method not work at the second view elements(textBox)
}