473,396 Members | 1,918 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,396 software developers and data experts.

Binding an ASCX?

I have an ASCX (I think thats called a user control), with a public
property of "TextStatic".

I want to put this ASCX into a datagrid's template item and bind a
data sources to the TextStatic property.

Is there any way to do this? I tried setting <Bindable(true)> to the
property, but that didn't seem to make the "TextStatic" property
showup in the Bindable properties of the ASCX.

Any idea?
Nov 18 '05 #1
4 2692
HI,

First, I don’t think that usercontrol should serve as datasource. It’s
better to create dedicate class as the dataprovider. Anyway in order to
supply data to datagrid your class should implement the
System.Collections.IEnumerable interface.

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #2
Thanks for the reply, but I think you are misunderstanding what I am
trying to do.

Say you have a datagrid. You can put a textbox into the ItemTemplate
for a row of the datagrid, and bind the "Text" property of the textbox
to the datasource.

This is what I want to do, but instead of using a textbox and "Text" I
want to use my ASCX control and "TextStatic", but when I put my ASCX
into the item template and go into the Bindings dialog, there are no
values that I can select to assign for binding (Such as "Text" or
"TextStatic").

Does that make sense?

Natty Gur <na***@dao2com.com> wrote in message news:<uO**************@TK2MSFTNGP11.phx.gbl>...
HI,

First, I don?t think that usercontrol should serve as datasource. It?s
better to create dedicate class as the dataprovider. Anyway in order to
supply data to datagrid your class should implement the
System.Collections.IEnumerable interface.

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 18 '05 #3
Yes it makes sense, Sorry.

Basically you just need to add property. it works fine with win forms
but not with web forms (as you say). I'm trying to figure it up.

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #4
Hi,
Still struggling but I just want to make sure that you aware that you
can bind the user control property without the visual designer:

<asp:DataGrid id="DataGrid1" style="Z-INDEX: 102; LEFT: 44px;
POSITION: absolute; TOP: 217px" runat="server"
AutoGenerateColumns="False">
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<uc1:WebUserControl1 id=WebUserControl11 runat="server"
MyText='<%# DataBinder.Eval(Container.DataItem, "Val") %>'>
</uc1:WebUserControl1>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:DataGrid>

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #5

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

Similar topics

4
by: Rob Meade | last post by:
Hi all, I have just put together our organisations 'template' for our web applications and have created 7 .ascx files which when dropped into my template file work perfectly...however, I have a...
6
by: tshad | last post by:
I have an ascx file I am using to include my logos and heading information for all my pages. It was working fine up until now. I decided to set up an admin folder inside of my main folder and...
0
by: Stephajn Craig | last post by:
I've built a customized collection class that has strongly typed objects in it. I have a collection class called LogEntryCollection with LogEntry objects in it. Each LogEntry object has certain...
0
by: damiensawyer | last post by:
Hello all, I'm very new to all of this. I have a theme and a skin (the standard ones). I have a standard master page which is holding a custom ascx which has a treeview in it. Can someone...
9
by: Jaybuffet | last post by:
my aspx has something like this <asp:Repeater id="Repeater1" runat="server"> <ItemTemplate> <mycontrol:ctl id="ctlId" obj='<%# Container.DataItem %>' showItem="true"/> </ItemTemplate>...
7
by: Owen Mortensen | last post by:
(This code was working in asp.net 1.1 VS2003. After upgrade to VS2005, chokes): in the aspx file: <ItemTemplate> <asp:datagrid id="dg_instr" runat="server" AutoGenerateColumns="False"...
2
by: Peter Kirk | last post by:
Hi I have an ascx (MainCalendarControl.ascx), which includes another ascx, by using this statement at the top of MainCalendarControl.ascx: Register TagPrefix="CalendarUI"...
0
by: bsaran | last post by:
Hi, I have a code that sort of works. The event flow is as follows: In a user control of type "FilterControl" user selects certain values from 3 related dropdown lists. (two of them have auto...
3
by: Steven Nagy | last post by:
Hi all, ASP.NET : Framework 2.0 - C# A recent addition to my code generater will create GridView's and ObjectDataSource's in a control (ASCX). So the code gen creates an ascx, ascx.cs,...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.