Rank: Newbie Groups: Member
Joined: 9/27/2007 Posts: 5
|
Hi i have a problem with the TreeView Control. I use framework 2.0, asp net c#, ajax. In a webForm, i have register a UserControl.ascx that inside has a dialog control. In dialog's content template there is a TreeView that i populate in dinamic way. When i use the first time,there is not a problem, but i use the second time, (use the method Treeviw.nodes.clear() for delete the presents nodes), the TriewView is populate but i click on the button present in dialog's content template for excute a routine, appears a error text "Argument of postback o callback don't valid". This erron don't appears if i don't use the methos Treeviw.nodes.clear().
Thank you
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi Metoda,
What version of the DLL do you use? We recently fixed a problem related to view state. So you might want to give the latest build (2007.1.43) a try. If that does not fix it, please cretae a reproducing sample for us and we would be happy to look into it.
Thanks
|
Rank: Newbie Groups: Member
Joined: 9/27/2007 Posts: 5
|
hi i have try the latest build but that does not fix. here post the code: UserControl.ascx aspx
Code: HTML/ASPX
<eo:Dialog ID="dialogDomTree" runat="server" AllowResize="True" BackColor="Silver"
BackShadeColor="255, 255, 192" BackShadeOpacity="3" BorderColor="#335C88" BorderStyle="Solid"
BorderWidth="1px" CancelButtonPostBack="True"
ControlSkinID="None" HeaderHtml="APRI" Height="400px" InitialState="Visible" ResizeImageUrl="00020014" RestoreButtonUrl="00070103" SaveLocation="True"
ShadowColor="LightGray" ShadowDepth="3" VerticalAlign="Top" Visible="False" Width="500px" IsModal="False">
<HeaderStyleActive CssText="background-image:url(00070104);color:white;font-family:Verdana;font-size:11px;font-weight:bold;padding-bottom:3px;padding-left:4px;padding-right:4px;padding-top:3px;" />
<ContentTemplate>
<asp:UpdatePanel ID="UpdatePaneldom" runat="server" UpdateMode="always">
<ContentTemplate>
<div style="height: 45%">
<eo:TreeView ID="TreeDom" runat="server" ControlSkinID="" Height="400px" LoadingLookID="_Default" RaisesServerEvent="false" OnItemPopulate="Tree_ItemPopulate">
<LookNodes>
<eo:TreeNode ExpandedStyle-CssText="" HoverStyle-CssText="background-color:white;border-bottom-color:transparent;border-left-color:transparent;border-right-color:transparent;border-top-color:transparent;color:navy;cursor:hand;font-family:Verdana;font-size:10px;font-weight:bold;"
ItemID="_Default" NormalStyle-CssText="background-color:transparent;border-bottom-style:none;border-left-style:none;border-right-style:none;border-top-style:none;color:navy;font-family:Verdana;font-size:10px;"
SelectedExpandedStyle-CssText="background-color:white;color:navy;cursor:wait;font-family:Verdana;font-size:10px;font-weight:bold;"
SelectedHoverStyle-CssText="background-color:white;color:navy;cursor:hand;font-family:Verdana;font-size:10px;font-weight:bold;"
SelectedStyle-CssText="background-color:white;color:navy;cursor:hand;font-family:Verdana;font-size:10px;font-weight:bold;">
</eo:TreeNode>
</LookNodes>
</eo:TreeView>
</div>
<div style="bottom: 0px; height: 0px; width: 100%">
<table>
<tr>
<td>
<asp:Button ID="butConferma" runat="server" CausesValidation="false" CssClass="ButtonStyle" OnClientClick="chiudiDialogModale('dialogDomTree')" Text="Conferma" Visible="true" OnClick="butConferma_Click" Enabled="true" />
</td>
<td>
<asp:Button ID="butModifica" CausesValidation=true runat="server" CssClass="ButtonStyle" OnClientClick="chiudiDialogModale('dialogDomTree')" Text="Modifica" Visible="true" Enabled="true" OnClick="butModifica_Click" />
</td>
<td>
<asp:Button ID="butDuplica" CausesValidation=true runat="server" CssClass="ButtonStyle" OnClientClick="chiudiDialogModale('dialogDomTree')" Text="Duplica" Visible="true" Enabled="true" OnClick="butDuplica_Click" />
</td>
<td>
<br />
<asp:Button ID="butAnnulla" runat="server" CssClass="ButtonStyle" OnClientClick="chiudiDialogModale('dialogDomTree')" Text="Annulla" Visible="true" OnClick="butAnnulla_Click" /><br />
</td>
<td>
<asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePaneldom"
DisplayAfter="0" DynamicLayout="true">
<ProgressTemplate>
<span style="font-family: Verdana; font-weight: bold; font-size: xx-small; color: Navy">
Attendere......</span>
</ProgressTemplate>
</asp:UpdateProgress>
<asp:TextBox ID="textTipoBut" runat="server" BackColor="Transparent" BorderColor="Transparent"
BorderStyle="None" Width="0px"></asp:TextBox></td>
</tr>
</table>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</ContentTemplate>
<ContentStyleActive CssText="border-top: #335c88 1px solid; background-color: #e5f1fd" />
<FooterStyleActive CssText="background-color: #e5f1fd; padding-bottom: 8px;" />
</eo:Dialog>[
Code CS
Code: C#
public partial class DomTree : System.Web.UI.UserControl
{
private string fase = null;
private ArrayList listaSubfase = null;
private ArrayList listaNomParametri = null;
private Hashtable parametri = null;
private int livelloAbilitaOp;
private int tipoBottone = -1;
#region DELEGATI
public delegate void Operazione(string codice, string mess);
private Operazione opConferma = null;
private Operazione opDuplica = null;
private Operazione opModifica = null;
public void setConfermaDel(Operazione op)
{
opConferma = op;
Button butConf = ((Button)dialogDomTree.ContentContainer.FindControl("butConferma"));
butConf.Visible = true;
butConf.Enabled = true;
Button butMod = ((Button)dialogDomTree.ContentContainer.FindControl("butModifica"));
butMod.Visible = false;
butMod.Enabled = true;
Button butDup = ((Button)dialogDomTree.ContentContainer.FindControl("butDuplica"));
butDup.Visible = false;
butDup.Enabled = true;
}
public void setModificaDel(Operazione op)
{
opModifica = op;
Button butMod = ((Button)dialogDomTree.ContentContainer.FindControl("butModifica"));
butMod.Visible = true;
butMod.Enabled = true;
Button butConf = ((Button)dialogDomTree.ContentContainer.FindControl("butConferma"));
butConf.Visible = false;
butConf.Enabled = true;
}
public void setDuplicaDel(Operazione op)
{
opDuplica = op;
Button butDup = ((Button)dialogDomTree.ContentContainer.FindControl("butDuplica"));
butDup.Visible = true;
butDup.Enabled = true;
Button butConf = ((Button)dialogDomTree.ContentContainer.FindControl("butConferma"));
butConf.Visible = false;
butConf.Enabled = true;
}
#endregion
protected void Page_Load(object sender, EventArgs e)
{
try
{
}
catch (Exception ex)
{
string errMsg = ex.Message;
throw (ex);
}
}
#region TreeView
private void CaricaTree(EO.Web.TreeNode node, string _fase, ArrayList _listaSubFase, Hashtable _parametri, int indiceNodo,int tipoBottoni)
{
DBManager dbMan = null;
ANAScript aScript = null;
DataTable dt = null;
int nodeLevel = -1;
string query = "";
try
{
if (node == null)
nodeLevel = -1;
else
nodeLevel = node.Level;
string ConnectionString = Global.rVigServer.leggiStringaConnessione(Moduli.AR);
aScript = new ANAScript(ConnectionString, Moduli.AR);
foreach (DictionaryEntry dictionaryEntry in _parametri)
{
string oKey = Convert.ToString(dictionaryEntry.Key);
string oValue = Convert.ToString(dictionaryEntry.Value);
aScript.addParameter(oKey, oValue); // Elaborazione
}
aScript.estraiScriptFase(_fase, Convert.ToString(_listaSubFase[++nodeLevel]));
if (!aScript.firstRow())
return;
//PrimoLivello
if (node == null)
{
query = aScript.curScript();
dbMan = new DBManager(ConnectionString);
dt = dbMan.sqlSelect(query);
EO.Web.TreeView tree = (EO.Web.TreeView)dialogDomTree.ContentContainer.FindControl("TreeDom");
for (int i = 0; i < dt.Rows.Count; i++)
{
EO.Web.TreeNode item = new EO.Web.TreeNode();
item.ItemID = Convert.ToString(dt.Rows[i][0]);
item.Text = Convert.ToString(dt.Rows[i][1]);
item.PopulateOnDemand = true;
item.OnClickScript = "AbilitaPulsantiDomTree(0,'" + livelloAbilitaOp + "','"+ tipoBottoni +"')";
tree.Nodes.Add(item);
}
}
else //Successivi Livelli
{
query = aScript.curScript();
dbMan = new DBManager(ConnectionString);
dt = dbMan.sqlSelect(query);
int livelloNodo = node.Level;
++livelloNodo;
for (int i = 0; i < dt.Rows.Count; i++)
{
EO.Web.TreeNode item = new EO.Web.TreeNode();
//item.TargetWindow = Convert.ToString(dt.Rows[i]["REPORT"]);
item.ItemID = Convert.ToString(dt.Rows[i][0]);
//FOGLIA
if (livelloNodo == livelloAbilitaOp - 1)
{
item.PopulateOnDemand = false;
item.Text = item.ItemID + "-" + Convert.ToString(dt.Rows[i][1]);
}
else
{
item.PopulateOnDemand = true;
item.Text = Convert.ToString(dt.Rows[i][1]);
}
item.OnClickScript = "AbilitaPulsantiDomTree('" + nodeLevel + "'," + livelloAbilitaOp + ",'" + tipoBottoni + "')";
node.SubGroup.Nodes.Add(item);
}
}
}
catch (Exception ex)
{
string errMsg = ex.Message;
throw (ex);
}
}
protected void Tree_ItemPopulate(object sender, EO.Web.NavigationItemEventArgs e)
{
try
{
EO.Web.TreeNode Node = (EO.Web.TreeNode)e.NavigationItem;
if (Node.ChildNodes.Count == 0)
{
listaSubfase = (ArrayList)ViewState["listSubFase"];
livelloAbilitaOp = Convert.ToInt32(ViewState["livelloTree"]);
tipoBottone = Convert.ToInt32(Convert.ToString(ViewState["tipoButt"]));
fase = Convert.ToString(ViewState["fase"]);
listaNomParametri = (ArrayList)ViewState["listaParam"];
int levelNode = Node.Level;
parametri = new Hashtable();
parametri.Add(listaNomParametri[0], DateTime.Now.ToString("yyyyMMdd"));
parametri.Add(listaNomParametri[++levelNode], Node.ItemID);
tipoBottone = Convert.ToInt32(Convert.ToString(ViewState["tipoButt"]));
CaricaTree(Node, fase, listaSubfase, parametri, livelloAbilitaOp,tipoBottone);
}
}
catch (Exception ex)
{
string errMsg = ex.Message;
throw (ex);
}
}
public void setLivelloAbilitaOp(string livello)
{
try
{
}
catch (Exception ex)
{
ex.Message.ToString();
throw (ex);
}
}
private void clearTree()
{
try
{
EO.Web.TreeView tree = (EO.Web.TreeView)dialogDomTree.ContentContainer.FindControl("TreeDom");
tree.Nodes.Clear();
}
catch (Exception ex)
{
string errMsg = ex.Message;
throw (ex);
}
}
#endregion
#region Eventi Pulsanti
protected void butConferma_Click(object sender, EventArgs e)
{
try
{
EO.Web.TreeNode treeNodeSelected = ((EO.Web.TreeView)dialogDomTree.ContentContainer.FindControl("TreeDom")).SelectedNode;
Conferma(treeNodeSelected.ItemID, treeNodeSelected.Text);
}
catch (Exception ex)
{
string errMsg = ex.Message;
throw (ex);
}
}
protected void butAnnulla_Click(object sender, EventArgs e)
{
try
{
setModale(false);
setVisibility(false);
}
catch (Exception ex)
{
string errMsg = ex.Message;
throw (ex);
}
}
protected void butModifica_Click(object sender, EventArgs e)
{
try
{
EO.Web.TreeNode treeNodeSelected = ((EO.Web.TreeView)dialogDomTree.ContentContainer.FindControl("TreeDom")).SelectedNode;
Modifica(treeNodeSelected.ItemID, treeNodeSelected.Text);
setVisibility(false);
setModale(false);
}
catch (Exception ex)
{
string err = ex.Message;
throw (ex);
}
}
protected void butDuplica_Click(object sender, EventArgs e)
{
try
{
EO.Web.TreeNode treeNodeSelected = ((EO.Web.TreeView)dialogDomTree.ContentContainer.FindControl("TreeDom")).SelectedNode;
Duplica(treeNodeSelected.ItemID,treeNodeSelected.Text);
}
catch (Exception ex)
{
string err = ex.Message;
throw (ex);
}
}
#endregion
#region Operazioni
private void Conferma(string id, string codice)
{
try
{
opConferma(id, codice);
setVisibility(false);
setModale(false);
}
catch (Exception ex)
{
string err = ex.Message;
throw (ex);
}
}
private void Modifica(string codice, string des)
{
try
{
opModifica(codice, des);
//setVisibility(false);
//setModale(false);
}
catch (Exception ex)
{
string err = ex.Message;
throw (ex);
}
}
private void Duplica(string codice, string des)
{
try
{
opDuplica(codice, des);
setVisibility(false);
setModale(false);
}
catch (Exception ex)
{
string err = ex.Message;
throw (ex);
}
}
private void Annulla()
{
try
{
setVisibility(false);
setModale(false);
}
catch (Exception ex)
{
string errMsg = ex.Message;
throw (ex);
}
}
#endregion
#region Dialog
private void CloseDialog()
{
setVisibility(false);
}
public void OpenDialog(string _fase, ArrayList _listaSubFase, int _livelloAbilitaOp, ArrayList _listaNomeParametri,int tipoB)
{
int tipo = -1;
try
{
setVisibility(true);
fase = _fase;
listaSubfase = _listaSubFase;
listaNomParametri = _listaNomeParametri;
livelloAbilitaOp = _livelloAbilitaOp;
parametri = new Hashtable();
parametri.Add(_listaNomeParametri[0], DateTime.Now.ToString("yyyyMMdd"));
ViewState["listSubFase"] = listaSubfase;
ViewState["livelloTree"] = livelloAbilitaOp;
ViewState["fase"] = fase;
ViewState["listaParam"] = listaNomParametri;
ViewState["parametri"] = parametri;
//tipo = Convert.ToInt32(Convert.ToString(ViewState["tipoButt"])); //Convert.ToInt32( ((TextBox)dialogDomTree.ContentContainer.FindControl("textTipoBut")).Text);
clearTree();
CaricaTree(null, fase, listaSubfase, parametri, -1, tipoB);
ViewState["tipoButt"] = tipoB;
}
catch (Exception ex)
{
string errMsg = ex.Message;
throw (ex);
}
}
public void setVisibility(bool visible)
{
try
{
this.dialogDomTree.Visible = visible;
}
catch (Exception ex)
{
string errMsg = ex.Message;
throw (ex);
}
}
public void setModale(bool modale)
{
try
{
this.dialogDomTree.IsModal = modale;
}
catch (Exception ex)
{
string errMsg = ex.Message;
throw (ex);
}
}
public void setTipoBottone(string _tipo)
{
try
{
//TextBox tipoBut=((TextBox)dialogDomTree.ContentContainer.FindControl("textTipoBut"));
//tipoBut.Text = _tipo;
ViewState["tipoButt"] = _tipo;
}
catch (Exception ex)
{
string errMsg = ex.Message;
throw (ex);
}
}
#endregion
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi Metoda,
We would need to you create a reproducing project for us because obviously your code references some other class and also your database, so we can't run it here. Unless we can load it and run it at here to see the error, it will be almost impossible for us to identify the root cause.
Thanks
|
Rank: Newbie Groups: Member
Joined: 9/27/2007 Posts: 5
|
Can i send you the project' files in zip format ? If yes, i send you by email. ok?
|