Jul 16, 2009, 12:49 PM
AjaxMethod and and textfields
Hi,
I'm having some problem with my application. I got some code from dynamicdrive.com, which opens a Javascript window on the page. The reason why I'm not using an <ext:Window here is because I wan't to be able to style it the way I want. The dynamicdrive code can be found here:
http://www.dynamicdrive.com/dynamici...ndow/index.htm
In my repeater, I have a link that calls for the javascript function ShowWindow():
I appreciate any help!
I'm having some problem with my application. I got some code from dynamicdrive.com, which opens a Javascript window on the page. The reason why I'm not using an <ext:Window here is because I wan't to be able to style it the way I want. The dynamicdrive code can be found here:
http://www.dynamicdrive.com/dynamici...ndow/index.htm
In my repeater, I have a link that calls for the javascript function ShowWindow():
<asp:Repeater ID="RepeaterLabelsAndText" runat="server">
<ItemTemplate>
<a href="#" onclick="ShowWindow('<%# DataBinder.Eval(Container.DataItem, "ID") %>')"><img src="images/livescribe_pen.png" alt="" /></a>
</ItemTemplate>
</asp:Repeater>
In that javascript function, I'm calling an AjaxMethod in codebehind, and the script that opens the window from dynamicdrive:<script type="text/javascript" language="javascript">
function ShowWindow(obj)
{
Coolite.AjaxMethods.EditLabel(obj);
var googlewin=divwin=dhtmlwindow.open('divbox', 'div', 'somediv', '', 'width=450px,height=450px,left=200px,top=150px,resize=1,scrolling=1');
}
</script>
Here is the codebehind:[AjaxMethod]
public void EditLabel(string Id)
{
LabelItem item = LabelItems.GetLabelItem(int.Parse(Id));
if (item != null)
{
txtLabelId.Text = item.ID.ToString();
txtLabelName.Text = "test";
txtLabelText.Text = item.LabelText;
txtLabelDesc.Text = item.LabelDesc;
TextBox1.Text = "tester";
}
}
And the div thats being opened by the <div id="somediv" style="display:none">
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<ext:TextField ID="txtLabelId" runat="server" Visible="false"></ext:TextField>
Name<br />
<ext:TextField ID="txtLabelName" runat="server"></ext:TextField><br /><br />
Text<br />
<ext:HtmlEditor id="txtLabelText" EnableAlignments="false" EnableSourceEdit="false" runat="server" Height="160" FieldLabel="Text" Width="450" /><br /><br />
Description<br />
<ext:TextField ID="txtLabelDesc" runat="server"></ext:TextField>
When I put a break point in the AjaxMethod, I see that the function is being "hit", and I'm getting the right results, and its being inserted in the different textboxes. The window also opens up nice. But the problem is that the textboxes remain empty? Does anybody know what I am doing wrong? Is there something I should rethink?I appreciate any help!