Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > onItemDataBound event not firing on first go thru since moving to .net 2.0

Reply
Thread Tools

onItemDataBound event not firing on first go thru since moving to .net 2.0

 
 
TS
Guest
Posts: n/a
 
      11-27-2006
I have this custom data list control and i override the onItemDatabound
event. After upgrading to vs 2005, this event is not always getting called,
though it does at other times. No changes were made when upgrading to 2.0

is there any reason for this because of .net 2.0?

thanks


 
Reply With Quote
 
 
 
 
Eric
Guest
Posts: n/a
 
      11-27-2006
What type of control is this? In general, I think the event is
ataBound in .NET 2.0.

TS wrote:
> I have this custom data list control and i override the onItemDatabound
> event. After upgrading to vs 2005, this event is not always getting called,
> though it does at other times. No changes were made when upgrading to 2.0
>
> is there any reason for this because of .net 2.0?
>
> thanks


 
Reply With Quote
 
 
 
 
TS
Guest
Posts: n/a
 
      11-27-2006
it is a control that inherits from DataList. The databinding does occur
after the page has posted back in some other parts of code - which correctly
calls the onDataBound event.

Also, this code worked correctly in 1.x but now fails.

thanks!

"Eric" <> wrote in message
news: ps.com...
> What type of control is this? In general, I think the event is
> ataBound in .NET 2.0.
>
> TS wrote:
>> I have this custom data list control and i override the onItemDatabound
>> event. After upgrading to vs 2005, this event is not always getting
>> called,
>> though it does at other times. No changes were made when upgrading to 2.0
>>
>> is there any reason for this because of .net 2.0?
>>
>> thanks

>



 
Reply With Quote
 
TS
Guest
Posts: n/a
 
      11-27-2006
Also Why is it that this custom dataList of mine calls DataBind()
automatically (i know this because when my itemDataBound event runs, it runs
twice when i manually call DataBind())?

I also have a regular dataGrid on the page, but if i dont' set DAtaBind()
for it, it won't bind itself. Since DataList and DataGrid both inherit from
BAseDataList, i would expect both to either call databind() automatically or
not at all.

Whats the deal here?

thanks

"TS" <> wrote in message
news:%...
>I have this custom data list control and i override the onItemDatabound
>event. After upgrading to vs 2005, this event is not always getting called,
>though it does at other times. No changes were made when upgrading to 2.0
>
> is there any reason for this because of .net 2.0?
>
> thanks
>



 
Reply With Quote
 
TS
Guest
Posts: n/a
 
      11-27-2006
I have been looking at
http://msdn2.microsoft.com/en-us/library/aa479321.aspx but it doesn't
mention the base class for DataList, BaseDataList. Am i to assume that the
topics in this article don't relate to DAtaList or DataGrid (both inherit
from BaseDataList)?

thanks

"TS" <> wrote in message
news:%...
>I have this custom data list control and i override the onItemDatabound
>event. After upgrading to vs 2005, this event is not always getting called,
>though it does at other times. No changes were made when upgrading to 2.0
>
> is there any reason for this because of .net 2.0?
>
> thanks
>



 
Reply With Quote
 
TS
Guest
Posts: n/a
 
      11-28-2006
actually i think that it doesn't call DataBind() automatically, i found a
spot that was calling it anyways.


"TS" <> wrote in message
news:ug5LL%...
> Also Why is it that this custom dataList of mine calls DataBind()
> automatically (i know this because when my itemDataBound event runs, it
> runs twice when i manually call DataBind())?
>
> I also have a regular dataGrid on the page, but if i dont' set DAtaBind()
> for it, it won't bind itself. Since DataList and DataGrid both inherit
> from BAseDataList, i would expect both to either call databind()
> automatically or not at all.
>
> Whats the deal here?
>
> thanks
>
> "TS" <> wrote in message
> news:%...
>>I have this custom data list control and i override the onItemDatabound
>>event. After upgrading to vs 2005, this event is not always getting
>>called, though it does at other times. No changes were made when upgrading
>>to 2.0
>>
>> is there any reason for this because of .net 2.0?
>>
>> thanks
>>

>
>



 
Reply With Quote
 
Eric
Guest
Posts: n/a
 
      11-28-2006
If a control has a DataSource, DataBind will automatically be called.
I'm not sure if this is the case for you or not.

Are you using .NET 1.1 or 2.0? It sounds like you're still using 1.1.
2.0 doesn't have the DataGrid control (it has been replaced with the
GridView) and the onItemDatabound event is generally called DataBound.

TS wrote:
> actually i think that it doesn't call DataBind() automatically, i found a
> spot that was calling it anyways.
>
>
> "TS" <> wrote in message
> news:ug5LL%...
> > Also Why is it that this custom dataList of mine calls DataBind()
> > automatically (i know this because when my itemDataBound event runs, it
> > runs twice when i manually call DataBind())?
> >
> > I also have a regular dataGrid on the page, but if i dont' set DAtaBind()
> > for it, it won't bind itself. Since DataList and DataGrid both inherit
> > from BAseDataList, i would expect both to either call databind()
> > automatically or not at all.
> >
> > Whats the deal here?
> >
> > thanks
> >
> > "TS" <> wrote in message
> > news:%...
> >>I have this custom data list control and i override the onItemDatabound
> >>event. After upgrading to vs 2005, this event is not always getting
> >>called, though it does at other times. No changes were made when upgrading
> >>to 2.0
> >>
> >> is there any reason for this because of .net 2.0?
> >>
> >> thanks
> >>

> >
> >


 
Reply With Quote
 
Walter Wang [MSFT]
Guest
Posts: n/a
 
      11-28-2006
Although it's recommended to use GridView in 2.0, DataGrid is still
supported in 2.0. It's actually improved to support a new way of
databinding that using DataSource control.

When you're using declarative way to set the DataSourceID property of a
data-bound control, you don't have to call DataBind() manually; but you
have to call DataBind() if you're setting DataSource property in code.

TS, would you please post some code of your DataList inherited control?
Thanks.


Sincerely,
Walter Wang (, remove 'online.')
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications. If you are using Outlook Express, please make sure you clear the
check box "Tools/Options/Read: Get 300 headers at a time" to see your reply
promptly.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

 
Reply With Quote
 
TS
Guest
Posts: n/a
 
      11-28-2006
to re-iterate, after the first time the databind event occurs during a
postback, it fails. The second time and every time after that, you postback
and call it and it works.

"TS" <> wrote in message
news:%...
>i have attached the code and this is the method that binds it:
> private void LoadReport()
> {
> this.report = new Report(GetReportXmlDocument(), mReportName, "table",
> "TEA");
> this.rplCriteria.ControlsAssemblyFile =
> this.report.BaseControlAssemblyFile;
> this.rplCriteria.DataSource = this.report.Parameters;
> this.rplCriteria.DataBind();
>
> // If the report contains no control parameters & not initial page load,
> go straight to the report viewer
> if (this.rplCriteria.Items.Count == 0 && IsPostBack){
> RunReport();
> }
> else{
> this.lblReportTitle.Text = this.report.Title;
> }
> }
>
> every time when it goes to bind, its data source has items. The first or
> second time the page posts back, the onItemDataBound event won't fire,
> after that it does. Again, the datasource is the same always, and the code
> worked correctly in 1.x.
>
> thanks!
>
> "Walter Wang [MSFT]" <> wrote in message
> news:...
>> Although it's recommended to use GridView in 2.0, DataGrid is still
>> supported in 2.0. It's actually improved to support a new way of
>> databinding that using DataSource control.
>>
>> When you're using declarative way to set the DataSourceID property of a
>> data-bound control, you don't have to call DataBind() manually; but you
>> have to call DataBind() if you're setting DataSource property in code.
>>
>> TS, would you please post some code of your DataList inherited control?
>> Thanks.
>>
>>
>> Sincerely,
>> Walter Wang (, remove 'online.')
>> Microsoft Online Community Support
>>
>> ==================================================
>> Get notification to my posts through email? Please refer to
>> http://msdn.microsoft.com/subscripti...ult.aspx#notif
>> ications. If you are using Outlook Express, please make sure you clear
>> the
>> check box "Tools/Options/Read: Get 300 headers at a time" to see your
>> reply
>> promptly.
>>
>> Note: The MSDN Managed Newsgroup support offering is for non-urgent
>> issues
>> where an initial response from the community or a Microsoft Support
>> Engineer within 1 business day is acceptable. Please note that each
>> follow
>> up response may take approximately 2 business days as the support
>> professional working with you may need further investigation to reach the
>> most efficient resolution. The offering is not appropriate for situations
>> that require urgent, real-time or phone-based interactions or complex
>> project analysis and dump analysis issues. Issues of this nature are best
>> handled working with a dedicated Microsoft Support Engineer by contacting
>> Microsoft Customer Support Services (CSS) at
>> http://msdn.microsoft.com/subscripti...t/default.aspx.
>> ==================================================
>>
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>>

>
>
>



 
Reply With Quote
 
TS
Guest
Posts: n/a
 
      11-28-2006
OK the way the page is set up, initial page load occurs then a postback
occurs which calls the databind. If I put a call to databind during initial
page load, the itemDataBound event is called correctly. For some reason the
intial call to databind when called during the 1st postback is causing
problems.

One other thing to keep in mind is that for some reason the page_load &
page_pre_render are running twice (probably all the page's events). The page
load runs twice, then pre-render runs twice in that exact order, so it
DOESNT' do a load-->pre-render-->Load-->pre-render. IT DOES
load-->load-->pre-render-->pre-render. I am attaching the stack track to
show you the difference comparing the 1st load to the 2nd load which both
occur on a single request for the page.

I have verified that this does not happen in VS 2003 with the same page and
i can find no other pages in vs 2005 that have their load event run twice.
This page is identical except for vs 2005 specific revisions which don't
change anything. This page does have a base class, but its load event only
runs ONCE!

When I put a call to databind during initial page load, the itemDataBound
event is called correctly for both page posts.

If you think double events firing is unrelated to our issue then no
investigation is required.

Thanks!

"TS" <> wrote in message
news:...
> to re-iterate, after the first time the databind event occurs during a
> postback, it fails. The second time and every time after that, you
> postback
> and call it and it works.
>
> "TS" <> wrote in message
> news:%...
>>i have attached the code and this is the method that binds it:
>> private void LoadReport()
>> {
>> this.report = new Report(GetReportXmlDocument(), mReportName, "table",
>> "TEA");
>> this.rplCriteria.ControlsAssemblyFile =
>> this.report.BaseControlAssemblyFile;
>> this.rplCriteria.DataSource = this.report.Parameters;
>> this.rplCriteria.DataBind();
>>
>> // If the report contains no control parameters & not initial page load,
>> go straight to the report viewer
>> if (this.rplCriteria.Items.Count == 0 && IsPostBack){
>> RunReport();
>> }
>> else{
>> this.lblReportTitle.Text = this.report.Title;
>> }
>> }
>>
>> every time when it goes to bind, its data source has items. The first or
>> second time the page posts back, the onItemDataBound event won't fire,
>> after that it does. Again, the datasource is the same always, and the
>> code
>> worked correctly in 1.x.
>>
>> thanks!
>>
>> "Walter Wang [MSFT]" <> wrote in message
>> news:...
>>> Although it's recommended to use GridView in 2.0, DataGrid is still
>>> supported in 2.0. It's actually improved to support a new way of
>>> databinding that using DataSource control.
>>>
>>> When you're using declarative way to set the DataSourceID property of a
>>> data-bound control, you don't have to call DataBind() manually; but you
>>> have to call DataBind() if you're setting DataSource property in code.
>>>
>>> TS, would you please post some code of your DataList inherited control?
>>> Thanks.
>>>
>>>
>>> Sincerely,
>>> Walter Wang (, remove 'online.')
>>> Microsoft Online Community Support
>>>
>>> ==================================================
>>> Get notification to my posts through email? Please refer to
>>> http://msdn.microsoft.com/subscripti...ult.aspx#notif
>>> ications. If you are using Outlook Express, please make sure you clear
>>> the
>>> check box "Tools/Options/Read: Get 300 headers at a time" to see your
>>> reply
>>> promptly.
>>>
>>> Note: The MSDN Managed Newsgroup support offering is for non-urgent
>>> issues
>>> where an initial response from the community or a Microsoft Support
>>> Engineer within 1 business day is acceptable. Please note that each
>>> follow
>>> up response may take approximately 2 business days as the support
>>> professional working with you may need further investigation to reach
>>> the
>>> most efficient resolution. The offering is not appropriate for
>>> situations
>>> that require urgent, real-time or phone-based interactions or complex
>>> project analysis and dump analysis issues. Issues of this nature are
>>> best
>>> handled working with a dedicated Microsoft Support Engineer by
>>> contacting
>>> Microsoft Customer Support Services (CSS) at
>>> http://msdn.microsoft.com/subscripti...t/default.aspx.
>>> ==================================================
>>>
>>> This posting is provided "AS IS" with no warranties, and confers no
>>> rights.
>>>

>>
>>
>>

>
>








 
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
Free Moving Estimate, Local Movers, Long Distance Moving, PackingSupplies, Storage Rental, Home Moving, Apartment Moving, Office Moving,Commercial Moving linkswanted ASP .Net 0 01-06-2008 04:45 AM
DataGrid ItemCommand event not firing if not first page =?Utf-8?B?ZGFuYw==?= ASP .Net 3 10-26-2005 05:24 PM
VB.NET code troubleshooting (CommandArgument property during OnItemDataBound event) jason ASP .Net 2 06-14-2005 12:35 PM
NEWBIE:Compare if value of variable has changed since last time thru a loop Mista_Blista Perl Misc 2 02-26-2004 04:19 PM
OnItemDataBound event not firing GOKU24 ASP .Net Building Controls 0 07-08-2003 08:05 PM



Advertisments