You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by hu...@apache.org on 2005/11/11 14:32:02 UTC
svn commit: r332546 - in /struts/sandbox/trunk/overdrive/Nexus/Web:
GridControl.ascx.cs ViewControl.ascx.cs
Author: husted
Date: Fri Nov 11 05:31:56 2005
New Revision: 332546
URL: http://svn.apache.org/viewcvs?rev=332546&view=rev
Log:
OVR-21
* Add support for programatic templates to GridControl
OVR-24
* Add FindControlParam method to workaround DataGridCommandEventArgs issue.
Modified:
struts/sandbox/trunk/overdrive/Nexus/Web/GridControl.ascx.cs
struts/sandbox/trunk/overdrive/Nexus/Web/ViewControl.ascx.cs
Modified: struts/sandbox/trunk/overdrive/Nexus/Web/GridControl.ascx.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/Nexus/Web/GridControl.ascx.cs?rev=332546&r1=332545&r2=332546&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/Nexus/Web/GridControl.ascx.cs (original)
+++ struts/sandbox/trunk/overdrive/Nexus/Web/GridControl.ascx.cs Fri Nov 11 05:31:56 2005
@@ -403,7 +403,7 @@
#region Special ReadControls method
- private void ReadGridControls(ControlCollection controls, IDictionary dictionary, string[] keys, bool nullIfEmpty)
+ protected void ReadGridControls(ControlCollection controls, IDictionary dictionary, string[] keys, bool nullIfEmpty)
{
int i = -1;
foreach (Control t in controls)
@@ -671,7 +671,7 @@
return key;
}
- private ControlCollection GetControls(DataGridCommandEventArgs e)
+ public virtual ControlCollection GetControls(DataGridCommandEventArgs e)
{
DataGrid grid = Grid;
ControlCollection controls = new ControlCollection(grid);
@@ -1015,14 +1015,14 @@
public void InstantiateIn(Control container)
{
Literal lc = new Literal();
+ lc.ID = _DataField;
lc.DataBinding += new EventHandler(LiteralTemplate_DataBinding);
container.Controls.Add(lc);
}
public LiteralTemplate (string dataField)
- {
- _DataField = dataField;
-
+ {
+ _DataField = dataField;
}
}
@@ -1036,15 +1036,15 @@
container.Controls.Add(_List);
}
- public DropDownListTemplate(object dataSource)
+ public DropDownListTemplate(string id, object dataSource)
{
_List = new DropDownList();
+ _List.ID = id;
_List.DataSource = dataSource;
_List.DataBind();
}
}
-
-
+
#endregion
}
Modified: struts/sandbox/trunk/overdrive/Nexus/Web/ViewControl.ascx.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/Nexus/Web/ViewControl.ascx.cs?rev=332546&r1=332545&r2=332546&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/Nexus/Web/ViewControl.ascx.cs (original)
+++ struts/sandbox/trunk/overdrive/Nexus/Web/ViewControl.ascx.cs Fri Nov 11 05:31:56 2005
@@ -219,6 +219,42 @@
}
}
+ /// <summary>
+ /// Kludgy method to read the value of a control
+ /// directly from the request under certain circumstances.
+ /// </summary>
+ /// <remarks><p>
+ /// This method is intended to workaround a problem
+ /// we are having with dymanci DataGrid templates.
+ /// The template column seems to be absent from the event args.
+ /// Other columns are there, but a template column is ignored.
+ /// </p><p>
+ /// This method can retrieve the value directly from the request
+ /// *if* the identifier is a unique string of characters that
+ /// won't be found as part of another parameter.
+ /// The DataGrid changes the identifer name,
+ /// but appends the control id given by the template.
+ /// So, we use key.IndexOf to find the control id within the
+ /// manufactured parameter id.
+ /// Kludgy, but it's only meant as a workaround (see OVR-24).
+ /// </p></remarks>
+ ///
+ /// <param name="id">Control ID</param>
+ /// <returns>Value of first paramter that has "id"
+ /// as any part of its name.</returns>
+ protected string FindControlValue(string id)
+ {
+ string ctlKey = null;
+ string[] keys = Request.Params.AllKeys;
+ foreach (string key in keys)
+ {
+ bool found = (key.IndexOf(id)>-1);
+ if (found) ctlKey = key;
+ continue;
+ }
+ return Request.Params[ctlKey]; // FIXME
+ }
+
#endregion
#region ViewState methods
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org