PDA

View Full Version : TextField in not active Tab is empty



niichavo
Mar 26, 2009, 11:57 AM
I'm sorry, i'm russian. :) Excuse for my English

piece of MasterPage:



<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" EnableTheming="true" %>
<%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>Untitled Page</title>

<link href="css/StyleSheet.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/JScript.js"></script>

</head>
<body>

<form id="form1" runat="server">
<ext:ScriptManager ID="ScriptManager2" runat="server" Theme="Gray">
</ext:ScriptManager>

<table style="width: 100%; height: 100%; "
cellspacing="0" cellpadding="0" border="0">
<tr>
<td>...</td>
<td>...</td>
...
<td>
<asp:contentplaceholder id="ContentPlaceHolder1" runat="server">
</asp:contentplaceholder>
</td>
...


piece of Aspx Page:



<ext:Panel ID="Panel1" runat="server"
Width="740"
Height="615"
Border="false"
BodyBorder="false"
>
<Body>
<ext:BorderLayout ID="BorderLayout1" runat="server">
<West Split="true">
<ext:Panel
ID="WestPanel"
runat="server"
Width="340"
AutoScroll="true">
<Body>
<ext:TreePanel ID="TreePanelStructure" runat="server"
Animate="true"
Border="false"
Stateful="true">
...
</ext:TreePanel>
</Body>
<TopBar>
<ext:Toolbar ID="TreeTopBar" runat="server">
...
</ext:Toolbar>
</TopBar>
</ext:Panel>
</West>
<Center>
<ext:TabPanel
ID="CenterPanel"
runat="server"
>
<Tabs>
<ext:Tab
ID="TabInfo"
runat="server"
Title="Info"
Border="false"
<Body>
<ext:FormLayout ID="FormLayout3" runat="server" LabelWidth="85" >
...
</ext:FormLayout>
</Body>
</ext:Tab>
<ext:Tab
ID="TabPhoto"
runat="server"
Title="Photo"
Border="false"
Stateful="true"
<Body>
<asp:Image ID="ImagePhoto" runat="server"/>
</Body>
</ext:Tab>
<ext:Tab
ID="TabAdmin"
runat="server"
Title="Admin"
Border="false"
<Body>
<ext:FormLayout ID="FormLayoutAdmins" runat="server" LabelWidth="85" >
<ext:Anchor Horizontal="100%">
<ext:TextField ID="TextFieldLogin" runat="server" FieldLabel="Login" />
</ext:Anchor>
<ext:Anchor Horizontal="100%">
<ext:ComboBox ID="ComboBoxMemberOf" runat="server" FieldLabel="Member of"
Editable="false"
DisplayField="cn"
ValueField="cn"
TypeAhead="true"
Mode="Local"
ForceSelection="true"
TriggerAction="All"
StoreID="StoreMemberOf">
</ext:ComboBox>
</ext:Anchor>
</ext:FormLayout>
</Body>
</ext:Tab>
</Tabs>
<Buttons>
<ext:Button ID="ButtonSave" runat="server"
Text="Save"
Icon="Disk"
>
<Listeners>
<Click Handler="userInfoUpdate(#{TreePanelStructure}.getSelectionM odel().getSelectedNode())" />
</Listeners>
</ext:Button>
</Buttons>
</ext:TabPanel>

</Center>
</ext:BorderLayout>
</Body>
<Plugins>
<ext:PanelResizer ID="Resizer" runat="server">
</ext:PanelResizer>
</Plugins>
</ext:Panel>

...

<script type="text/javascript">

function userInfoUpdate(node)
{
if (node == null)
return;

Coolite.AjaxMethods.UserInfoUpdateAjax(node.id,
node.attributes.TypeOfNode, {
success: function(result) {

},

failure: function(errorMsg) {
Ext.Msg.alert('Error', errorMsg);
}
});
}
</script>


C# (The problem description in comments):



[Coolite.Ext.Web.AjaxMethod]
public string UserInfoUpdateAjax(string nodeID, string TypeOfNode)
{
string id = string.Format("<GUID={0}>", nodeID);
StringBuilder values = new StringBuilder();

string sn = TextFieldSecondName.Text; // from active tab with id "TabInfo". Here everything is all right
string givenName = TextFieldName.Text; // from active tab with id "TabInfo". Here everything is all right

...

values.AppendFormat("{0} {1}", sn, givenName);

// TextFieldLogin.Text - It is always empty, while you will not click on tab with id "TabAdmin"
// (It's enough to click only once)
values.AppendFormat("\r\n{0}", TextFieldLogin.Text);

...

return "CCCP"
}


TextFieldLogin.Text fills from another Ajax Method when clicked on TreePanel Node.

Thanks

Vladimir
Mar 26, 2009, 12:11 PM
Hi,

One question: Did you activate tab "TabAdmin" at least once before calling an AjaxMethod? Try to set DeferredRender="false" for TabPanel

niichavo
Mar 26, 2009, 12:29 PM
vladimir (3/26/2009)Hi,

One question: Did you activate tab "TabAdmin" at least once before calling an AjaxMethod? Try to set DeferredRender="false" for TabPanel



No, I didn't. In this case TextField.Text was empty.
Miracle! :) DeferredRender="false" solved my problem! Thank You and SpasiBO!