473,385 Members | 1,769 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

WebControls

I created a webcontrol with inside a dropdownlist, and exposed its
proprieties DataSource,DataMember,DataTextField,DataValueField
But I can't set the DataSource from the aspx page
(DataSource='<%#this.DataSource%>' ). If I set a breakpoint inside the
DataSet propriety, I see that
the thread never reach this point, the DataSource propriety will never be
called. Why?

<%@ Register TagPrefix="wcl" Namespace="WebControlLibrary1"
Assembly="WebControlLibrary1" %>
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false"
Inherits="WebProject1.WebForm1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>WebForm1</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout"
xmlns:wcl="urn:http://schemas.myCompany.org/myTechnology">
<form id="Form1" method="post" runat="server">
&nbsp;
<wcl:WebCustomControl1 id="WebCustomControl11"
DataSource='<%#this.DataSource%>' DataMember="ddl" DataTextField="text"
DataValueField="value" style="Z-INDEX: 101; LEFT: 56px; POSITION: absolute;
TOP: 48px"
runat="server"></wcl:WebCustomControl1>
</form>
</body>
</HTML>
namespace WebProject1
{
public class WebForm1 : System.Web.UI.Page
{
protected WebControlLibrary1.WebCustomControl1 WebCustomControl11;
private System.Data.DataSet ds;

private void Page_Load(object sender, System.EventArgs e)
{
if(Session["StoreData"] == null)
{
DataRow dr;
ds=new DataSet();
DataTable t=new DataTable("ddl");
t.Columns.Add(new DataColumn("value",typeof(int)));
t.Columns.Add(new DataColumn("text",typeof(string)));
t.Rows.Add(new object[]{1,"one"});
t.Rows.Add(new object[]{2,"two"});
t.Rows.Add(new object[]{3,"three"});
t.Rows.Add(new object[]{4,"four"});
this.ds.Tables.Add(t);
Session["StoreData"] = ds;
}
else ds=(DataSet)Session["StoreData"];
}

public DataSet DataSource
{
get{return this.ds;}
}
}
}

namespace WebControlLibrary1
{
[DefaultProperty("Text"),
ToolboxData("<{0}:WebCustomControl1
runat=server></{0}:WebCustomControl1>")]
public class WebCustomControl1 : System.Web.UI.WebControls.WebControl
{
private System.Web.UI.WebControls.DropDownList _dropDownList=new
DropDownList();

public object DataSource
{
get{return this._dropDownList.DataSource;}
set{this._dropDownList.DataSource=value;}
}

public string DataMember
{
get{return this._dropDownList.DataMember;}
set{this._dropDownList.DataMember=value;}
}

public string DataTextField
{
get{return this._dropDownList.DataTextField;}
set{this._dropDownList.DataTextField=value;}
}

public string DataValueField
{
get{return this._dropDownList.DataValueField;}
set{this._dropDownList.DataValueField=value;}
}

protected override void Render(HtmlTextWriter output)
{
this._dropDownList.DataBind();
this._dropDownList.RenderControl(output);
}
}
}
Nov 15 '05 #1
2 1995
Hello:
i donot think so the DataSource propriety can be writen in .aspx page.
"Zürcher See" <aq****@cannabismail.com> дÈëÓʼþ
news:uN****************@TK2MSFTNGP11.phx.gbl...
I created a webcontrol with inside a dropdownlist, and exposed its
proprieties DataSource,DataMember,DataTextField,DataValueField
But I can't set the DataSource from the aspx page
(DataSource='<%#this.DataSource%>' ). If I set a breakpoint inside the
DataSet propriety, I see that
the thread never reach this point, the DataSource propriety will never be
called. Why?

<%@ Register TagPrefix="wcl" Namespace="WebControlLibrary1"
Assembly="WebControlLibrary1" %>
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="WebProject1.WebForm1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>WebForm1</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout"
xmlns:wcl="urn:http://schemas.myCompany.org/myTechnology">
<form id="Form1" method="post" runat="server">
&nbsp;
<wcl:WebCustomControl1 id="WebCustomControl11"
DataSource='<%#this.DataSource%>' DataMember="ddl" DataTextField="text"
DataValueField="value" style="Z-INDEX: 101; LEFT: 56px; POSITION: absolute; TOP: 48px"
runat="server"></wcl:WebCustomControl1>
</form>
</body>
</HTML>
namespace WebProject1
{
public class WebForm1 : System.Web.UI.Page
{
protected WebControlLibrary1.WebCustomControl1 WebCustomControl11;
private System.Data.DataSet ds;

private void Page_Load(object sender, System.EventArgs e)
{
if(Session["StoreData"] == null)
{
DataRow dr;
ds=new DataSet();
DataTable t=new DataTable("ddl");
t.Columns.Add(new DataColumn("value",typeof(int)));
t.Columns.Add(new DataColumn("text",typeof(string)));
t.Rows.Add(new object[]{1,"one"});
t.Rows.Add(new object[]{2,"two"});
t.Rows.Add(new object[]{3,"three"});
t.Rows.Add(new object[]{4,"four"});
this.ds.Tables.Add(t);
Session["StoreData"] = ds;
}
else ds=(DataSet)Session["StoreData"];
}

public DataSet DataSource
{
get{return this.ds;}
}
}
}

namespace WebControlLibrary1
{
[DefaultProperty("Text"),
ToolboxData("<{0}:WebCustomControl1
runat=server></{0}:WebCustomControl1>")]
public class WebCustomControl1 : System.Web.UI.WebControls.WebControl
{
private System.Web.UI.WebControls.DropDownList _dropDownList=new
DropDownList();

public object DataSource
{
get{return this._dropDownList.DataSource;}
set{this._dropDownList.DataSource=value;}
}

public string DataMember
{
get{return this._dropDownList.DataMember;}
set{this._dropDownList.DataMember=value;}
}

public string DataTextField
{
get{return this._dropDownList.DataTextField;}
set{this._dropDownList.DataTextField=value;}
}

public string DataValueField
{
get{return this._dropDownList.DataValueField;}
set{this._dropDownList.DataValueField=value;}
}

protected override void Render(HtmlTextWriter output)
{
this._dropDownList.DataBind();
this._dropDownList.RenderControl(output);
}
}
}



Nov 15 '05 #2
If you place a DropDownList on the page, not in a WebControl, you can set
the DataSource and it works fine.
But if I plate the DropDownList in a WebControl it does not work anymore

"Kenneth" <do*********@hotmail.com.discuss> schrieb im Newsbeitrag
news:%2***************@tk2msftngp13.phx.gbl...
Hello:
i donot think so the DataSource propriety can be writen in .aspx page.
"Zürcher See" <aq****@cannabismail.com> дÈëÓʼþ
news:uN****************@TK2MSFTNGP11.phx.gbl...
I created a webcontrol with inside a dropdownlist, and exposed its
proprieties DataSource,DataMember,DataTextField,DataValueField
But I can't set the DataSource from the aspx page
(DataSource='<%#this.DataSource%>' ). If I set a breakpoint inside the
DataSet propriety, I see that
the thread never reach this point, the DataSource propriety will never be called. Why?

<%@ Register TagPrefix="wcl" Namespace="WebControlLibrary1"
Assembly="WebControlLibrary1" %>
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs"

AutoEventWireup="false"
Inherits="WebProject1.WebForm1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>WebForm1</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout"
xmlns:wcl="urn:http://schemas.myCompany.org/myTechnology">
<form id="Form1" method="post" runat="server">
&nbsp;
<wcl:WebCustomControl1 id="WebCustomControl11"
DataSource='<%#this.DataSource%>' DataMember="ddl" DataTextField="text"
DataValueField="value" style="Z-INDEX: 101; LEFT: 56px; POSITION:

absolute;
TOP: 48px"
runat="server"></wcl:WebCustomControl1>
</form>
</body>
</HTML>
namespace WebProject1
{
public class WebForm1 : System.Web.UI.Page
{
protected WebControlLibrary1.WebCustomControl1 WebCustomControl11;
private System.Data.DataSet ds;

private void Page_Load(object sender, System.EventArgs e)
{
if(Session["StoreData"] == null)
{
DataRow dr;
ds=new DataSet();
DataTable t=new DataTable("ddl");
t.Columns.Add(new DataColumn("value",typeof(int)));
t.Columns.Add(new DataColumn("text",typeof(string)));
t.Rows.Add(new object[]{1,"one"});
t.Rows.Add(new object[]{2,"two"});
t.Rows.Add(new object[]{3,"three"});
t.Rows.Add(new object[]{4,"four"});
this.ds.Tables.Add(t);
Session["StoreData"] = ds;
}
else ds=(DataSet)Session["StoreData"];
}

public DataSet DataSource
{
get{return this.ds;}
}
}
}

namespace WebControlLibrary1
{
[DefaultProperty("Text"),
ToolboxData("<{0}:WebCustomControl1
runat=server></{0}:WebCustomControl1>")]
public class WebCustomControl1 : System.Web.UI.WebControls.WebControl
{
private System.Web.UI.WebControls.DropDownList _dropDownList=new
DropDownList();

public object DataSource
{
get{return this._dropDownList.DataSource;}
set{this._dropDownList.DataSource=value;}
}

public string DataMember
{
get{return this._dropDownList.DataMember;}
set{this._dropDownList.DataMember=value;}
}

public string DataTextField
{
get{return this._dropDownList.DataTextField;}
set{this._dropDownList.DataTextField=value;}
}

public string DataValueField
{
get{return this._dropDownList.DataValueField;}
set{this._dropDownList.DataValueField=value;}
}

protected override void Render(HtmlTextWriter output)
{
this._dropDownList.DataBind();
this._dropDownList.RenderControl(output);
}
}
}


Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Chuck Farah | last post by:
I keep getting this error running a VB .NET web forms application. I exit visual studio kill the aspnet_wp.exe process and restart vs and works again. Any help would be appreciated. Just to...
4
by: Rodrigo DeJuana | last post by:
Howdy, I'm new to this .net stuff and really have little to no training. Im trying to create a new page for a web form, so i have been pretty much jsut coping code. I having some issue with...
3
by: CW | last post by:
I have downloaded, built and installed iewebcontrols. I tested the sample application and everything worked just fine. However, when I attempt to add Microsoft.Web.UI.WebControls.dll to the VS.Net...
1
by: KMart | last post by:
Hello, I have a ASP.NET/C# application that uses the IE Web Controls. Everything was working fine. Then, for some unknown reason, everything stopped working. Here's the error information: ...
0
by: I am Sam | last post by:
Ok whats wrong with my toolbar? When I debug I don't get an error message and the databinding is working correctly but the toolbar itself and the <iewc:ToolbarDropDownlist /> control isn't showing...
1
by: Lorenc | last post by:
Recently I am getting this error randomly while working with visual studio ..NET 2003 on a C# project and browsing my application. Everything comes to normal after rebooting. Can someone help on...
3
by: dave | last post by:
We have an application that works perfectly in-house (tested on 3 different servers). It uses Microsoft.Web.UI.WebControls.dll for menubars and toolbars. Problem Description: We uploaded...
2
by: loga123 | last post by:
Hi All, I am using Link Button for DELETE on the gridview. When I click on DELETE link, I get the ArgumentOutOfRangeException. But...it deletes the record from table in the database. On...
1
by: loga123 | last post by:
Hi All, I am using Link Button for DELETE on the gridview. When I click on DELETE link, I get the ArgumentOutOfRangeException. But...it deletes the record from table in the database. On...
0
by: marcyb | last post by:
Can anyone help I am trying to get a WebControl toolbar to work this is my code for a toolbar in visual web developement 2005 express for C# <%@ Page Language="C#" Debug="true" %> <%@ Import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.