473,662 Members | 2,524 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help - Binding data on a UserControl within a DataGrid TemplateColumn

I have an application that was originally built with ASP.Net 1.1.

We finally got permission to migrate to 2.0. Due to time constraints we
migrated the web projects to 2.0 web application projects to minimize
required changes initially.

I am stuck on a problem using a data grid.

I have a usercontrol that has a DataGrid on it. The datagrid has an item
template that loads another common user control for every row. I am getting
a binding error. Here is a snippet of the html for the datagrid.

<cc1:mymsgrid id="dgWebLeftNa v" style="POSITION :relative" runat="server"
Width="100%" CellPadding="1" GridLines="None " AutoGenerateCol umns="False"
DataSource="<%# m_dsWebLeftNav. Tables[0].DefaultView %>" ShowHeader="Fal se">
<AlternatingIte mStyle CssClass="ListI tem1"></AlternatingItem Style>
<SelectedItemSt yle CssClass="DataG ridSelectedItem "></SelectedItemSty le>
<ItemStyle CssClass="ListI tem1"></ItemStyle>
<Behavior ShowSelection=" False"></Behavior>
<HeaderStyle Height="1px" CssClass="DataG ridHeader"
VerticalAlign=" Middle"></HeaderStyle>
<Columns>
<asp:TemplateCo lumn>
<ItemStyle HorizontalAlign ="Left"></ItemStyle>
<ItemTemplate >
<uc1:WebLeftNav Item id="WebLeftNavI tem"
runat="server"> </uc1:WebLeftNavI tem>
</ItemTemplate>
</asp:TemplateCol umn>
</Columns>
</cc1:mymsgrid>

Here is a snippet of some of the child user control items with their
binding:
<DIV id="divWebLeftN avList" style="WIDTH: 100%; POSITION: relative; HEIGHT:
64px" runat="server">
<asp:label id=lblLefNavNam e style="Z-INDEX: 104; LEFT: 103px; POSITION:
absolute; TOP: 1px" CssClass="Body_ Value9pt" runat="server" Width="290"
Text='<%# DataBinder.Eval (Container.Bind ingContainer,
"DataItem.WEB_L EFTNAV_NAME") %>'</asp:label>
<asp:label id=lblLeftNavTi tle style="Z-INDEX: 105; LEFT: 103px;
POSITION: absolute; TOP: 21px" CssClass="Body_ Value9pt" runat="server"
Width="290px" Text='<%#
DataBinder.Eval (Container.Bind ingContainer,"D ataItem.WEB_LEF TNAV_TITLE")
%>'></asp:label>
</DIV>

This was all working in Asp.net 1.1. The error I am getting is
"DataBindin g: 'Aon.PenProPlus .Web.UI.WebCont rols.MyMSGrid' does not contain
a property with the name 'Item'." MyMSGrid is a descendent of the DataGrid
where we added a few extensions that we use not related to databinding.

I am guessing that Container.Bindi ngContainer is returning a different
object that what asp.net 1.1 was returning.

Any help would be greatly appreciated.
Apr 23 '07 #1
1 2424
I typed the exception wrong. it should have been ....does not contain
a property with the name 'DataItem'

"Stephen Barrett" <stephen_barret t@aon_nospam.co mwrote in message
news:uk******** ******@TK2MSFTN GP06.phx.gbl...
>I have an application that was originally built with ASP.Net 1.1.

We finally got permission to migrate to 2.0. Due to time constraints we
migrated the web projects to 2.0 web application projects to minimize
required changes initially.

I am stuck on a problem using a data grid.

I have a usercontrol that has a DataGrid on it. The datagrid has an item
template that loads another common user control for every row. I am
getting a binding error. Here is a snippet of the html for the datagrid.

<cc1:mymsgrid id="dgWebLeftNa v" style="POSITION :relative" runat="server"
Width="100%" CellPadding="1" GridLines="None " AutoGenerateCol umns="False"
DataSource="<%# m_dsWebLeftNav. Tables[0].DefaultView %>"
ShowHeader="Fal se">
<AlternatingIte mStyle CssClass="ListI tem1"></AlternatingItem Style>
<SelectedItemSt yle CssClass="DataG ridSelectedItem "></SelectedItemSty le>
<ItemStyle CssClass="ListI tem1"></ItemStyle>
<Behavior ShowSelection=" False"></Behavior>
<HeaderStyle Height="1px" CssClass="DataG ridHeader"
VerticalAlign=" Middle"></HeaderStyle>
<Columns>
<asp:TemplateCo lumn>
<ItemStyle HorizontalAlign ="Left"></ItemStyle>
<ItemTemplate >
<uc1:WebLeftNav Item id="WebLeftNavI tem"
runat="server"> </uc1:WebLeftNavI tem>
</ItemTemplate>
</asp:TemplateCol umn>
</Columns>
</cc1:mymsgrid>

Here is a snippet of some of the child user control items with their
binding:
<DIV id="divWebLeftN avList" style="WIDTH: 100%; POSITION: relative;
HEIGHT: 64px" runat="server">
<asp:label id=lblLefNavNam e style="Z-INDEX: 104; LEFT: 103px; POSITION:
absolute; TOP: 1px" CssClass="Body_ Value9pt" runat="server" Width="290"
Text='<%# DataBinder.Eval (Container.Bind ingContainer,
"DataItem.WEB_L EFTNAV_NAME") %>'</asp:label>
<asp:label id=lblLeftNavTi tle style="Z-INDEX: 105; LEFT: 103px;
POSITION: absolute; TOP: 21px" CssClass="Body_ Value9pt" runat="server"
Width="290px" Text='<%#
DataBinder.Eval (Container.Bind ingContainer,"D ataItem.WEB_LEF TNAV_TITLE")
%>'></asp:label>
</DIV>

This was all working in Asp.net 1.1. The error I am getting is
"DataBindin g: 'Aon.PenProPlus .Web.UI.WebCont rols.MyMSGrid' does not
contain a property with the name 'Item'." MyMSGrid is a descendent of
the DataGrid where we added a few extensions that we use not related to
databinding.

I am guessing that Container.Bindi ngContainer is returning a different
object that what asp.net 1.1 was returning.

Any help would be greatly appreciated.

Apr 23 '07 #2

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

Similar topics

2
2233
by: rmorvay | last post by:
I am trying to dynamically build a dropdownlist and bind it to a cell in a grid. I tried to utilize the following code but I am stuck at the point where I bind the dropdownlist to the grid cell. I get the following message for this code but I suspect that the " UltraWebGrid1.Rows.Cells.Value = ddlGeography;" is not how you bind the dropdownlist control to the grid. ERROR: "The type 'System.Web.UI.WebControls.DropDownList' must be...
1
7565
by: Shourie | last post by:
I've noticed that none of the child controls events are firing for the first time from the dynamic user control. Here is the event cycle. 1) MainPage_load 2) User control1_Load user clicks a dropdown in UC1 _________________________ 1) MainPage_Load 2) User Control_1 Load
2
1790
by: News | last post by:
Hi I need help to display and edit data in a data grid within a repeater. The code is below: Sub dgrdEvents_EditCommand(sender As Object, e As DataGridCommandEventArgs) dgrdEvents.EditItemIndex = e.Item.ItemIndex BuildList() End Sub
1
1136
by: Kasey Rybic | last post by:
I am trying to put data from a field of a query in to the HeaderText arg and I keep getting an error. <asp:DataGrid id="dgMainCompany" runat="server" width="55%" HorizontalAlign="Left" AutoGenerateColumns="False" BackColor="WhiteSmoke" Font-Name="Verdana" Font-Size="11pt"> <HeaderStyle BackColor="Thistle" ForeColor="Black" Font-Bold="True" /> <Columns>
1
1014
by: Roy | last post by:
I have a datagrid, within that datagrid I have <columns> tag and within that I have the below TemplateColumn which calls to another datagrid (essentially and embedded datagrid within another datagrid). Unfortunately, I get this error with "newtier2" being the name of my ..ascx page... "Literal content ('</ItemTemplate> </asp:TemplateColumn> </columns> </ASP:DataGrid> </form> </body> </html>') is not allowed within a 'ASP.newtier2_ascx'."
6
2610
by: Alan Silver | last post by:
Hello, I am data binding a repeater that has a checkbox in the ItemTemplate. The data value coming out of the database is a char(1) field containing either "y" or "n". I want to use this value to set/unset the checkbox. I tried the following in the ItemTemplate... <asp:CheckBox ID="chkShowNpVar" Text="" Checked='<%(DataBinder.Eval(Container.DataItem, "showVar")=="y" ? true :
1
1295
by: momo | last post by:
Hello Guys, I am getting this error " Control 'oGrid__ctl14__ctl1' of type 'DataGridLinkButton' must be placed inside a form tag with runat=server." Here is my code and I don't know where it is doing it. Can some please help me
2
1913
by: momo | last post by:
Hello Guys, I have a bit of a problem, I created a Dll called SecureQueryStringDll.dll and I had the dll put bin folder of my application first and it did not work so I then put it in the bin folder of c:\inetpub\wwwroot and it still does not work. Here is the error I get from it: temporary asp.net files\root\d16a94c5\8b912d73\assembly\dl2\1dc1ef5c\006575a4_827ac301\metabuilders.webcontrols.rowselectorcolumn.dll"...
0
1289
by: Chu | last post by:
I've got a DataGrid that is bound at run-time to an ArrayList. In my DataGrid, I've created a <asp:templatecolumn> that and am using a custom web control in it, something like this: <asp:templatecolumn> <my:customControl someIDValue=""></my:customControl> </asp:templatecolumn> I'd like to bind the property of my server control someIDValue to a property from my ArrayList. Is there someway to accomplish this?
0
8344
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,...
0
8857
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, 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...
0
8764
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 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...
1
8546
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,...
0
8633
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6186
isladogs
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...
0
5654
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4347
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1993
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.