I created a webcontrol with inside a dropdownlist, and exposed its
proprieties DataSource,Data Member,DataText Field,DataValue Field
But I can't set the DataSource from the aspx page
(DataSource='<% #this.DataSourc e%>' ). 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="WebC ontrolLibrary1"
Assembly="WebCo ntrolLibrary1" %>
<%@ Page language="c#" Codebehind="Web Form1.aspx.cs" AutoEventWireup ="false"
Inherits="WebPr oject1.WebForm1 " %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>WebForm1 </title>
<meta name="GENERATOR " Content="Micros oft Visual Studio .NET 7.1">
<meta name="CODE_LANG UAGE" Content="C#">
<meta name="vs_defaul tClientScript" content="JavaSc ript">
<meta name="vs_target Schema"
content="http://schemas.microso ft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING= "GridLayout "
xmlns:wcl="urn: http://schemas.myCompa ny.org/myTechnology">
<form id="Form1" method="post" runat="server">
<wcl:WebCustomC ontrol1 id="WebCustomCo ntrol11"
DataSource='<%# this.DataSource %>' DataMember="ddl " DataTextField=" text"
DataValueField= "value" style="Z-INDEX: 101; LEFT: 56px; POSITION: absolute;
TOP: 48px"
runat="server"> </wcl:WebCustomCo ntrol1>
</form>
</body>
</HTML>
namespace WebProject1
{
public class WebForm1 : System.Web.UI.P age
{
protected WebControlLibra ry1.WebCustomCo ntrol1 WebCustomContro l11;
private System.Data.Dat aSet ds;
private void Page_Load(objec t sender, System.EventArg s e)
{
if(Session["StoreData"] == null)
{
DataRow dr;
ds=new DataSet();
DataTable t=new DataTable("ddl" );
t.Columns.Add(n ew DataColumn("val ue",typeof(int) ));
t.Columns.Add(n ew DataColumn("tex t",typeof(strin g)));
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)Ses sion["StoreData"];
}
public DataSet DataSource
{
get{return this.ds;}
}
}
}
namespace WebControlLibra ry1
{
[DefaultProperty ("Text"),
ToolboxData("<{ 0}:WebCustomCon trol1
runat=server></{0}:WebCustomCo ntrol1>")]
public class WebCustomContro l1 : System.Web.UI.W ebControls.WebC ontrol
{
private System.Web.UI.W ebControls.Drop DownList _dropDownList=n ew
DropDownList();
public object DataSource
{
get{return this._dropDownL ist.DataSource; }
set{this._dropD ownList.DataSou rce=value;}
}
public string DataMember
{
get{return this._dropDownL ist.DataMember; }
set{this._dropD ownList.DataMem ber=value;}
}
public string DataTextField
{
get{return this._dropDownL ist.DataTextFie ld;}
set{this._dropD ownList.DataTex tField=value;}
}
public string DataValueField
{
get{return this._dropDownL ist.DataValueFi eld;}
set{this._dropD ownList.DataVal ueField=value;}
}
protected override void Render(HtmlText Writer output)
{
this._dropDownL ist.DataBind();
this._dropDownL ist.RenderContr ol(output);
}
}
} 2 2007
Hello:
i donot think so the DataSource propriety can be writen in .aspx page.
"Zürcher See" <aq****@cannabi smail.com> дÈëÓʼþ
news:uN******** ********@TK2MSF TNGP11.phx.gbl. .. I created a webcontrol with inside a dropdownlist, and exposed its proprieties DataSource,Data Member,DataText Field,DataValue Field But I can't set the DataSource from the aspx page (DataSource='<% #this.DataSourc e%>' ). 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="WebC ontrolLibrary1" Assembly="WebCo ntrolLibrary1" %> <%@ Page language="c#" Codebehind="Web Form1.aspx.cs"
AutoEventWireup ="false" Inherits="WebPr oject1.WebForm1 " %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > <HTML> <HEAD> <title>WebForm1 </title> <meta name="GENERATOR " Content="Micros oft Visual Studio .NET 7.1"> <meta name="CODE_LANG UAGE" Content="C#"> <meta name="vs_defaul tClientScript" content="JavaSc ript"> <meta name="vs_target Schema" content="http://schemas.microso ft.com/intellisense/ie5"> </HEAD> <body MS_POSITIONING= "GridLayout " xmlns:wcl="urn: http://schemas.myCompa ny.org/myTechnology"> <form id="Form1" method="post" runat="server"> <wcl:WebCustomC ontrol1 id="WebCustomCo ntrol11" DataSource='<%# this.DataSource %>' DataMember="ddl " DataTextField=" text" DataValueField= "value" style="Z-INDEX: 101; LEFT: 56px; POSITION:
absolute; TOP: 48px" runat="server"> </wcl:WebCustomCo ntrol1> </form> </body> </HTML>
namespace WebProject1 { public class WebForm1 : System.Web.UI.P age { protected WebControlLibra ry1.WebCustomCo ntrol1 WebCustomContro l11; private System.Data.Dat aSet ds;
private void Page_Load(objec t sender, System.EventArg s e) { if(Session["StoreData"] == null) { DataRow dr; ds=new DataSet(); DataTable t=new DataTable("ddl" ); t.Columns.Add(n ew DataColumn("val ue",typeof(int) )); t.Columns.Add(n ew DataColumn("tex t",typeof(strin g))); 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)Ses sion["StoreData"]; }
public DataSet DataSource { get{return this.ds;} } } }
namespace WebControlLibra ry1 { [DefaultProperty ("Text"), ToolboxData("<{ 0}:WebCustomCon trol1 runat=server></{0}:WebCustomCo ntrol1>")] public class WebCustomContro l1 : System.Web.UI.W ebControls.WebC ontrol { private System.Web.UI.W ebControls.Drop DownList _dropDownList=n ew DropDownList();
public object DataSource { get{return this._dropDownL ist.DataSource; } set{this._dropD ownList.DataSou rce=value;} }
public string DataMember { get{return this._dropDownL ist.DataMember; } set{this._dropD ownList.DataMem ber=value;} }
public string DataTextField { get{return this._dropDownL ist.DataTextFie ld;} set{this._dropD ownList.DataTex tField=value;} }
public string DataValueField { get{return this._dropDownL ist.DataValueFi eld;} set{this._dropD ownList.DataVal ueField=value;} }
protected override void Render(HtmlText Writer output) { this._dropDownL ist.DataBind(); this._dropDownL ist.RenderContr ol(output); } } }
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*********@ho tmail.com.discu ss> schrieb im Newsbeitrag
news:%2******** *******@tk2msft ngp13.phx.gbl.. . Hello: i donot think so the DataSource propriety can be writen in .aspx page.
"Zürcher See" <aq****@cannabi smail.com> дÈëÓʼþ news:uN******** ********@TK2MSF TNGP11.phx.gbl. .. I created a webcontrol with inside a dropdownlist, and exposed its proprieties DataSource,Data Member,DataText Field,DataValue Field But I can't set the DataSource from the aspx page (DataSource='<% #this.DataSourc e%>' ). 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="WebC ontrolLibrary1" Assembly="WebCo ntrolLibrary1" %> <%@ Page language="c#" Codebehind="Web Form1.aspx.cs" AutoEventWireup ="false" Inherits="WebPr oject1.WebForm1 " %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > <HTML> <HEAD> <title>WebForm1 </title> <meta name="GENERATOR " Content="Micros oft Visual Studio .NET 7.1"> <meta name="CODE_LANG UAGE" Content="C#"> <meta name="vs_defaul tClientScript" content="JavaSc ript"> <meta name="vs_target Schema" content="http://schemas.microso ft.com/intellisense/ie5"> </HEAD> <body MS_POSITIONING= "GridLayout " xmlns:wcl="urn: http://schemas.myCompa ny.org/myTechnology"> <form id="Form1" method="post" runat="server"> <wcl:WebCustomC ontrol1 id="WebCustomCo ntrol11" DataSource='<%# this.DataSource %>' DataMember="ddl " DataTextField=" text" DataValueField= "value" style="Z-INDEX: 101; LEFT: 56px; POSITION: absolute; TOP: 48px" runat="server"> </wcl:WebCustomCo ntrol1> </form> </body> </HTML>
namespace WebProject1 { public class WebForm1 : System.Web.UI.P age { protected WebControlLibra ry1.WebCustomCo ntrol1 WebCustomContro l11; private System.Data.Dat aSet ds;
private void Page_Load(objec t sender, System.EventArg s e) { if(Session["StoreData"] == null) { DataRow dr; ds=new DataSet(); DataTable t=new DataTable("ddl" ); t.Columns.Add(n ew DataColumn("val ue",typeof(int) )); t.Columns.Add(n ew DataColumn("tex t",typeof(strin g))); 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)Ses sion["StoreData"]; }
public DataSet DataSource { get{return this.ds;} } } }
namespace WebControlLibra ry1 { [DefaultProperty ("Text"), ToolboxData("<{ 0}:WebCustomCon trol1 runat=server></{0}:WebCustomCo ntrol1>")] public class WebCustomContro l1 : System.Web.UI.W ebControls.WebC ontrol { private System.Web.UI.W ebControls.Drop DownList _dropDownList=n ew DropDownList();
public object DataSource { get{return this._dropDownL ist.DataSource; } set{this._dropD ownList.DataSou rce=value;} }
public string DataMember { get{return this._dropDownL ist.DataMember; } set{this._dropD ownList.DataMem ber=value;} }
public string DataTextField { get{return this._dropDownL ist.DataTextFie ld;} set{this._dropD ownList.DataTex tField=value;} }
public string DataValueField { get{return this._dropDownL ist.DataValueFi eld;} set{this._dropD ownList.DataVal ueField=value;} }
protected override void Render(HtmlText Writer output) { this._dropDownL ist.DataBind(); this._dropDownL ist.RenderContr ol(output); } } }
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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 re-iterate not a consitent error.
Configuration Error
Description: An error occurred during the processing of a
configuration file required to service this request.
Please review the specific error details below and modify
|
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 some textboxes not updating when i a hit
save.
for example I have this code in my aspx.cs file:
declared:
|
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 toolbox, I get the following
error:
There are no components in
'c:\windows\microsoft.net\framework\v1.1.4322\Microsoft.Web.UI.WebControls.d
ll" that can be placed on the toolbox. I am using VS.Net 2002. I tried
copying the...
|
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:
Server Error in '/application' Application.
----------------------------------------------------------------------------
----
|
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 up all that is returned to
the web page is the buttons text and the contents of the DropDownlist. What
am I doing wrong here? Below is the control I typed in and below that is the
code behind.
<iewc:toolbar id="Toolbar1" runat="server">...
| |
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 this? The following is the detail
error message:
Configuration Error
Description: An error occurred during the processing of a configuration file
required to service this request. Please review the specific error details
below and modify your...
|
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 the application to our webhost and an error came up:
|
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 Gridview_rowdatabound, I am dynamically building hyperlink control
based on the values in the other fields. Here is my code for
Gridview_rowdatabound. It does work sometimes though.
|
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 Gridview_rowdatabound, I am dynamically building hyperlink control
based on the values in the other fields. Here is my code for
Gridview_rowdatabound. It does work sometimes though.
|
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 Namespace="Microsoft.Web.UI.WebControls" %>
<%@ Register TagPrefix="ie" Namespace="Microsoft.Web.UI.WebControls"
Assembly="Microsoft.Web.UI.WebControls" %>
<html>
<head>
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |