Ask a Question related to ASP.NET General, Design and Development.
-
Lloyd Dupont #1
data binding problem
I have developped a custom user control (code at the end of the mail) which
is an <input> tag with a customized source and onclick method.
This custom control is in a repeater (in a template column of a datagrid, in
fact), when the user clicked it and the web form is updated its Filename
property has a now incorrect calue.
however when I click on another input element (for example I click on the
sort link at the top of the table) everything is then displayed correctly.
I'm puzzled, any tip ?
(Note: the Filename property is <%# databounded %>, of course !)
//--------- WebPreviewer.cs -------
using System;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ComponentModel;
namespace perso
{
/// <summary>
/// Summary description for WebCustomControl1.
/// </summary>
[DefaultProperty("Filename"),
ToolboxData("<{0}:WebPreviewer runat=server></{0}:WebPreviewer>")]
public class WebPreviewer : Control
{
private string text = @"?";
[Bindable(true), Category("Appearance"), DefaultValue("")]
public string Filename
{
get
{
return text;
}
set
{
text = value;
}
}
int size;
[Bindable(true), Category("Appearance"), DefaultValue("50")]
public int Size
{
get
{
if(size < 1)
return 50;
return size;
}
set
{
size = value;
}
}
protected override void OnPreRender(System.EventArgs e)
{
StringBuilder script = new StringBuilder();
script.Append("<script language='javascript'><!--\n");
script.Append("function __stuff_view(id,file,aW,aH){\n");
script.Append("\targs =
\"statuts,scrollbars,location,resizable,width=\"+a W+\",height=\"+aH;\n");
script.Append("\topen(file, id, args);\n");
script.Append("\treturn true;\n");
//script.Append("\treturn false;\n");
script.Append("}\n//--></script>");
Page.RegisterClientScriptBlock("__stuff_view",scri pt.ToString());
base.OnPreRender(e);
}
/// <summary>
/// Render this control to the output parameter specified.
/// </summary>
/// <param name="output"> The HTML writer to write out to </param>
protected override void Render(HtmlTextWriter output)
{
string myurl = Page.ResolveUrl(Filename);
myurl = HttpUtility.UrlEncode(myurl);
output.Write("<input type=image");
output.Write(" src='Previewer.aspx?size=");
output.Write(Size);
output.Write("&url=");
output.Write(myurl);
output.Write('\'');
output.Write(" onclick=\"return ");
output.Write("__stuff_view('awin','");
output.Write(myurl);
output.Write("','500','500')");
output.Write('\"');
output.Write("/>\n");
}
}
}
Lloyd Dupont Guest
-
dynamic chart data binding problem
Hello! I've been using Flex for all of about three days now, and have just hit a problem that I can't seem to find a solution for: I have a XML... -
Data Binding
I have a webService, dataSet, comboBox and a sumbitButton. The combobox loads and displays Brands from my cfc. I press submit and look at the... -
Complex data binding question, binding child objects of a custom collection.
I have a custom collection of objects, each of which includes a child object called MyUserOpener. In declarative binding, I can bind this property... -
problem in binding xml file data to datagrid xml file isgenerated through JSP file
problem it that i am creating xml file using JSP file and i want to bind DataGrid with xml file data that is created using JSP but it will not Bind... -
Data Binding and Edit/Update/Cancel Chicken-and-Egg Problem
Would you be able to help me out on this one? I've got a DataGrid control that I create dynamically - no problem there. I also add a hyperlink... -
Lloyd Dupont #2
Re: data binding problem
my property Filename is set as follow
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "Name")>
<asplloyd:WebPreviewer runat=server
Filename='<%# DataBinder.Eval(Container.DataItem, "Name")>'/>
</ItemTemplate>
so I display the theoric value of filename which is correct.
but for some reason the Filename property is not set ...
"Lloyd Dupont" <lloyd@RemoveIfNotSpamming.galador.net> a écrit dans le
message de news:un%23%23rsGTDHA.3192@tk2msftngp13.phx.gbl...which> I have developped a custom user control (code at the end of the mail)in> is an <input> tag with a customized source and onclick method.
> This custom control is in a repeater (in a template column of a datagrid,> fact), when the user clicked it and the web form is updated its Filename
> property has a now incorrect calue.
>
> however when I click on another input element (for example I click on the
> sort link at the top of the table) everything is then displayed correctly.
>
> I'm puzzled, any tip ?
>
> (Note: the Filename property is <%# databounded %>, of course !)
>
> //--------- WebPreviewer.cs -------
> using System;
>
> using System.Diagnostics;
>
> using System.Drawing;
>
> using System.Drawing.Imaging;
>
> using System.IO;
>
> using System.Text;
>
> using System.Web;
>
> using System.Web.UI;
>
> using System.Web.UI.WebControls;
>
> using System.ComponentModel;
>
> namespace perso
>
> {
>
> /// <summary>
>
> /// Summary description for WebCustomControl1.
>
> /// </summary>
>
> [DefaultProperty("Filename"),
>
> ToolboxData("<{0}:WebPreviewer runat=server></{0}:WebPreviewer>")]
>
> public class WebPreviewer : Control
>
> {
>
> private string text = @"?";
>
> [Bindable(true), Category("Appearance"), DefaultValue("")]
>
> public string Filename
>
> {
>
> get
>
> {
>
> return text;
>
> }
>
> set
>
> {
>
> text = value;
>
> }
>
> }
>
> int size;
>
> [Bindable(true), Category("Appearance"), DefaultValue("50")]
>
> public int Size
>
> {
>
> get
>
> {
>
> if(size < 1)
>
> return 50;
>
> return size;
>
> }
>
> set
>
> {
>
> size = value;
>
> }
>
> }
>
> protected override void OnPreRender(System.EventArgs e)
>
> {
>
> StringBuilder script = new StringBuilder();
>
> script.Append("<script language='javascript'><!--\n");
>
> script.Append("function __stuff_view(id,file,aW,aH){\n");
>
> script.Append("\targs =
> \"statuts,scrollbars,location,resizable,width=\"+a W+\",height=\"+aH;\n");
>
> script.Append("\topen(file, id, args);\n");
>
> script.Append("\treturn true;\n");
>
> //script.Append("\treturn false;\n");
>
> script.Append("}\n//--></script>");
>
> Page.RegisterClientScriptBlock("__stuff_view",scri pt.ToString());
>
> base.OnPreRender(e);
>
> }
>
>
>
> /// <summary>
>
> /// Render this control to the output parameter specified.
>
> /// </summary>
>
> /// <param name="output"> The HTML writer to write out to </param>
>
> protected override void Render(HtmlTextWriter output)
>
> {
>
> string myurl = Page.ResolveUrl(Filename);
>
> myurl = HttpUtility.UrlEncode(myurl);
>
> output.Write("<input type=image");
>
> output.Write(" src='Previewer.aspx?size=");
>
> output.Write(Size);
>
> output.Write("&url=");
>
> output.Write(myurl);
>
> output.Write('\'');
>
> output.Write(" onclick=\"return ");
>
> output.Write("__stuff_view('awin','");
>
> output.Write(myurl);
>
> output.Write("','500','500')");
>
> output.Write('\"');
>
> output.Write("/>\n");
>
> }
>
> }
>
> }
>
>
Lloyd Dupont Guest



Reply With Quote

