Hi, what I am doing is searching a text box which is on the WebDialogWindow .
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript">
function show() {
var dialogWindow = $find('<%=WebDialogWindow1.ClientID%>');
dialogWindow.show();
}
function getdata() {
var x = $find('<%= TextBox1.ClientID %>');
alert(x.value);
return false;
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button"
onclientclick="show();" />
</div>
<ig:WebDialogWindow ID="WebDialogWindow1" runat="server" Height="300px"
InitialLocation="Centered" Modal="True" Width="400px" WindowState="Hidden"
StyleSetName="Office2007Blue" MaintainLocationOnScroll="True"
BorderColor="White" BorderWidth="0px">
<ContentPane>
<Template>
<asp:TextBox ID="TextBox1" runat="server" Text="Amol"></asp:TextBox>
<asp:LinkButton ID="lnk" runat="server" OnClientClick="return getdata()" Text="Click Me"></asp:LinkButton>
</Template>
</ContentPane>
</ig:WebDialogWindow>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
</form>
</body>
</html>
The above scripts works well if used var x = $get('<%= TextBox1.ClientID %>'); in place of var x = $find('<%= TextBox1.ClientID %>');.
1) why this is happening as the WebDialogWindow is searched with the same method $find.
2) On some pages when I use <%= %> , the asp.net gives up runtime error that "The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>)", but when I change it <%# %>, it does not even find WebDialogWindow.
Can someone please explain this.
Hi Amol,
The AJAX method $find(id) returns reference to the javascript object which extends AJAX base class.
The AJAX method $get(id) returns reference to html element. In case of TextBox, there is no javascript object on client, but only plain INPUT html element. So, $find can not used.
Hi,
what about the WebDialogbox , can we find it using $find or $get ?