Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Issue with embedded datagrid.

Reply
Thread Tools

Issue with embedded datagrid.

 
 
ylockhead
Guest
Posts: n/a
 
      10-19-2005
I have a couple of problems with a datagrid (dgDetail) that is embedded on
another detagrid(dgMaster). On dgDetail, I have a dropdown listbox
(ddlbDecision) that I am trying populate. I put code in
dgDetail_ItemDataBound to populate the listboxt but it's not working.

My first problem is that the event dgDetail_ItemDataBound doens't get fired
automatically when dgDetail.DataBind() is executed. To get around this, I
trigger the event using dgdAddTimeRep_ItemDataBound(sender, e). Shouldn't
this event work automatically?

My second problem is how to reference the listbox ddlbDecision on dgDetail.
I have tried referecing the control using the following code but it doens't
work.
Dim ddlbDecision As System.Web.UI.WebControls.DropDownList =
CType(e.Item.FindControl("ddlbDecision "),
System.Web.UI.WebControls.DropDownList)

How can I reference the control ddlbDecision on the embedded datagrid so I
can populate it??

Thanks for your help.
 
Reply With Quote
 
 
 
 
Phillip Williams
Guest
Posts: n/a
 
      10-19-2005
The detail grid databind would fire by default before the parent control
databind therefore it seemed to you that ItemDataBound for the detail was not
fired because there was no data yet for the datasource of the detail when its
datagrid_databind event was handled. To verify that this is the case place
an If statement within your dgDetail_ItemDataBound to check if
e.Item.dataItem is Nothing.

You can explicity execute the detail grid databind method after you have
retrieved the detail data during the ItemDataBound event handling in the
master grid.

The command you used to find the dropdownlist is correct. But if you
attempted to use it when your datagrid binding happened on an empty
datasource that might explain you could not find the dropdownlist.

For a demo of what I just wrote above you may review this sample:
http://www.societopia.net/samples/Da...Hierarchy.aspx

--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com


"ylockhead" wrote:

> I have a couple of problems with a datagrid (dgDetail) that is embedded on
> another detagrid(dgMaster). On dgDetail, I have a dropdown listbox
> (ddlbDecision) that I am trying populate. I put code in
> dgDetail_ItemDataBound to populate the listboxt but it's not working.
>
> My first problem is that the event dgDetail_ItemDataBound doens't get fired
> automatically when dgDetail.DataBind() is executed. To get around this, I
> trigger the event using dgdAddTimeRep_ItemDataBound(sender, e). Shouldn't
> this event work automatically?
>
> My second problem is how to reference the listbox ddlbDecision on dgDetail.
> I have tried referecing the control using the following code but it doens't
> work.
> Dim ddlbDecision As System.Web.UI.WebControls.DropDownList =
> CType(e.Item.FindControl("ddlbDecision "),
> System.Web.UI.WebControls.DropDownList)
>
> How can I reference the control ddlbDecision on the embedded datagrid so I
> can populate it??
>
> Thanks for your help.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Embedded <divs> with events: How to prevent the parent div's eventfrom being fired when the embedded div's event is fired? Num GG Javascript 2 11-17-2008 08:56 PM
Embedded vs. Non-embedded Tests Trans Ruby 11 09-05-2007 11:22 AM
Embedded languages based on early Ada (from "Re: Preferred OS, processor family for running embedded Ada?") Colin Paul Gloster VHDL 48 04-10-2007 10:31 AM
How to display images embedded in e-mail as embedded, not attachments Jim Firefox 4 12-11-2004 05:36 AM
Databind an embedded control in an embedded datagrid Thomas Dodds ASP .Net Datagrid Control 0 07-26-2004 08:20 PM



Advertisments