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

Nested DDL in GridView ItemTemplates

Hi

I have a FormView that contains a GridView. The GridView is populated
from an ObjectDataSource. Two of the columns in the GridView are not
bound, and the values used in Update mode come from dropdowns (inside
of ItemTemplates).

In my ObjectDataSource, I have Parameters for the bound fields, and
ControlParameters for the DDLs. I cannot seem to access the DDLs since
they are so nested. I've tried:
<asp:ControlParameter ControlID="FormView$GridView$DDL" ......[Snipped]
but that doesn't work.
I've tried to do a GridView.FindControl with the ID of the DDL, but it
doesn't find it.
My GridView looks like this:

<asp:GridView id="CommGridView" runat="server"
DataKeyNames="id" DataSourceID="ObjectDataSource5"
AutoGenerateColumns="false" AutoGenerateEditButton=true>
<Columns>
<asp:TemplateField>
<EditItemTemplate>
<asp:DropDownList ID="DropDownListCommFields"
runat="server" DataSourceID="SqlDataSourceCommFields"
DataValueField="id" DataTextField="field" />
</EditItemTemplate>
<HeaderTemplate>
<b>Field</b>
</HeaderTemplate>
<ItemTemplate>
<%#CommFldLkp(Eval("field"))%>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
.......[Snipped]

Does anyone know how I can access the values stored in the DDL for use
as ControlParameters?

Thanks

Apr 5 '06 #1
2 2362
You need to put the ObjectDataSource control within the TemplateField which
contains the DDLs.

"bi*******@gmail.com" wrote:
Hi

I have a FormView that contains a GridView. The GridView is populated
from an ObjectDataSource. Two of the columns in the GridView are not
bound, and the values used in Update mode come from dropdowns (inside
of ItemTemplates).

In my ObjectDataSource, I have Parameters for the bound fields, and
ControlParameters for the DDLs. I cannot seem to access the DDLs since
they are so nested. I've tried:
<asp:ControlParameter ControlID="FormView$GridView$DDL" ......[Snipped]
but that doesn't work.
I've tried to do a GridView.FindControl with the ID of the DDL, but it
doesn't find it.
My GridView looks like this:

<asp:GridView id="CommGridView" runat="server"
DataKeyNames="id" DataSourceID="ObjectDataSource5"
AutoGenerateColumns="false" AutoGenerateEditButton=true>
<Columns>
<asp:TemplateField>
<EditItemTemplate>
<asp:DropDownList ID="DropDownListCommFields"
runat="server" DataSourceID="SqlDataSourceCommFields"
DataValueField="id" DataTextField="field" />
</EditItemTemplate>
<HeaderTemplate>
<b>Field</b>
</HeaderTemplate>
<ItemTemplate>
<%#CommFldLkp(Eval("field"))%>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
.......[Snipped]

Does anyone know how I can access the values stored in the DDL for use
as ControlParameters?

Thanks

Apr 5 '06 #2
OK Thanks. Since I have multiple template fields, do I just put it in
the first template field?

Thanks

Apr 5 '06 #3

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

Similar topics

0
by: hammad.awan_nospam | last post by:
Hello, I am using ASP.NET 2.0. What I have done is nested a gridview inside another column of a gridview using a template data field column declaritively in my web form. Inside this child...
3
by: Martin | last post by:
Hi, I have a very frustrating problem that I have researched for countless hours to no avail. There are many posts asking very similar things, however none usefull in my situation. I am using VS...
0
by: sloan | last post by:
I'm working on a application where I have 1 page which shows a GridView. I have this page working...with sorting, with paging...and I'm caching the first resultset,... to avoid unnecessary db...
4
by: Congero | last post by:
I'm trying to find a way to bind hierarchical data to a gridview control. I've been able to do this with some third party controls and was wondering if this functionality is available with the...
1
by: ram_kri | last post by:
Hi Guys, Here is a uncommon scenario that I had to work on.. I have a GridView which is associated to a DataSource. But I have a couple of columns (item-templates while the rest of the columns...
0
by: sharonrao123 | last post by:
hello all, I have a parent gridview company and in this one a nested gridview people, Is it possible to allow the user to select one row or multiple rows from the people gridview using a check box...
2
by: GISmatters | last post by:
I have unbound checkboxes in a nested gridview to allow multi-selection of "child" rows. For context, the parent gridview rows are for large "reports", the child rows are for various specific files...
6
by: RobertTheProgrammer | last post by:
Hi folks, Here's a weird problem... I have a nested GridView setup (i.e. a GridView within a GridView), and within the nested GridView I have a DropDownList item which has the...
0
by: Sody | last post by:
Hi, is in gridview any way how to control from codebehid if an itemtemplate in gridview will be set to visible = true / false ? here is an example of gridview with more itemtemplates ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: 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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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,...

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.