473,671 Members | 2,382 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Annoying problem with event being raised twice

I have DataList control on my own contro land it is bind to SqlDataSource
control. My problem is that DataList is getting needed data twice what is
for me very strange. I have some code in OnSelected event of SqlDataSource,
and i was suprised when it was fired twice for every page loading.

His is code of datalist:
<tr>
<td style="width: 5%;">
</td>
<td colspan="3">
<asp:DropDownLi st ID="ddlConversi onDates" runat="server"
AutoPostBack="T rue" DataSourceID="s qldsConversionD ates"
DataTextField=" ConversionDate"
DataValueField= "ConversionDate ">
</asp:DropDownLis t>
<asp:SqlDataSou rce ID="sqldsConver sionDates" runat="server"
ConnectionStrin g="<%$ ConnectionStrin gs:dbConnection String %>"
SelectCommand=" owrsp_GetConver sionDatesForPOS "
SelectCommandTy pe="StoredProce dure"
DataSourceMode= "DataReader ">
<SelectParamete rs>
<asp:Paramete r Name="jo" Type="String" />
</SelectParameter s>
</asp:SqlDataSour ce>
</td>
</tr>
<tr>
<td style="width: 5%;">
</td>
<td colspan="3">
<asp:Label ID="lSupportInf o" runat="server" Text=""
Visible="false" Font-Size="14px"
Font-Bold="true" Width="100%"></asp:Label>
<asp:DataList ID="dlSupportIn fo" runat="server"
DataKeyField="P rofileID" DataSourceID="s qldsSupportInfo "
Width="100%" RepeatDirection ="Horizontal " ShowFooter="Fal se"
ShowHeader="Fal se"
CssClass="dataT able" CellSpacing="-1"
OnPreRender="dl SupportInfo_Pre Render">
<ItemTemplate >
<asp:Label Font-Bold="true" ID="ProfileIDLa bel"
runat="server" Text='<%# Eval("ProfileID ") %>'
ToolTip='<%# "Profil: " + Eval("Name") +
Environment.New Line + Eval("Descripti on") %>'></asp:Label><br />
<asp:Label ID="SupportLabe l" runat="server" Text='<%#
Eval("Support") + " / " + Eval("Need") %>'
ToolTip=""></asp:Label><br />
</ItemTemplate>
</asp:DataList>
<asp:SqlDataSou rce ID="sqldsSuppor tInfo" runat="server"
ConnectionStrin g="<%$ ConnectionStrin gs:dbConnection String %>"
SelectCommand=" owrsp_GetInfoFo rSupportPOSNeed "
SelectCommandTy pe="StoredProce dure"
DataSourceMode= "DataReader "
OnSelected="sql dsSupportInfo_S elected">
<SelectParamete rs>
<asp:Paramete r Name="jo" Type="String" />
<asp:ControlPar ameter ControlID="ddlC onversionDates"
Name="conversio nDate" PropertyName="S electedValue"
Type="DateTime" />
</SelectParameter s>
</asp:SqlDataSour ce>
</td>
</tr>

Here i set jo params i page load:

protected void Page_Load(objec t sender, EventArgs e)
{
//getting JO of updating POS
NavigatorItem selectedItem = (NavigatorItem) Parameters["Item"];
unitName = selectedItem.Te xt;
GetSelectedItem JO(selectedItem );

//setting parameters of controls
sqldsConversion Dates.SelectPar ameters["jo"].DefaultValue = jo;
sqldsSupportInf o.SelectParamet ers["jo"].DefaultValue = jo;
}

This is call trace:
Function:
Coordinators_Us erControls_Supp ort_POS.sqldsSu pportInfo_Selec ted(object,
System.Web.UI.W ebControls.SqlD ataSourceStatus EventArgs), Thread: 0xF40 <No
Name>, Stack:
App_Web_irip9ki 6.dll!Coordinat ors_UserControl s_Support_POS.s qldsSupportInfo _Selected
System.Web.dll! System.Web.UI.W ebControls.SqlD ataSourceView.O nSelected
System.Web.dll! System.Web.UI.W ebControls.SqlD ataSourceView.E xecuteSelect
System.Web.dll! System.Web.UI.W ebControls.Base DataList.GetDat a
System.Web.dll! System.Web.UI.W ebControls.Data List.CreateCont rolHierarchy
System.Web.dll! System.Web.UI.W ebControls.Base DataList.OnData Binding
System.Web.dll! System.Web.UI.W ebControls.Base DataList.DataBi nd
System.Web.dll! System.Web.UI.W ebControls.Base DataList.Ensure DataBound
System.Web.dll! System.Web.UI.W ebControls.Base DataList.Create ChildControls
System.Web.dll! System.Web.UI.C ontrol.EnsureCh ildControls
System.Web.dll! System.Web.UI.C ontrol.PreRende rRecursiveInter nal
System.Web.dll! System.Web.UI.C ontrol.PreRende rRecursiveInter nal
System.Web.dll! System.Web.UI.C ontrol.PreRende rRecursiveInter nal
System.Web.dll! System.Web.UI.C ontrol.PreRende rRecursiveInter nal
System.Web.dll! System.Web.UI.C ontrol.PreRende rRecursiveInter nal
System.Web.dll! System.Web.UI.C ontrol.PreRende rRecursiveInter nal
System.Web.dll! System.Web.UI.C ontrol.PreRende rRecursiveInter nal
System.Web.dll! System.Web.UI.P age.ProcessRequ estMain
System.Web.dll! System.Web.UI.P age.ProcessRequ est
System.Web.dll! System.Web.UI.P age.ProcessRequ est
System.Web.dll! System.Web.UI.P age.ProcessRequ estWithNoAssert
System.Web.dll! System.Web.UI.P age.ProcessRequ est
App_Web_w8u2q5z q.dll!ASP.coord inators_coordin atorsportal_asp x.ProcessReques t
System.Web.dll! System.Web.Http Application.Cal lHandlerExecuti onStep.System.W eb.HttpApplicat ion.IExecutionS tep.Execute
System.Web.dll! System.Web.Http Application.Exe cuteStep
System.Web.dll! System.Web.Http Application.Res umeSteps
System.Web.dll! System.Web.Http Application.Sys tem.Web.IHttpAs yncHandler.Begi nProcessRequest
System.Web.dll! System.Web.Http Runtime.Process RequestInternal
System.Web.dll! System.Web.Http Runtime.Process RequestNow
System.Web.dll! System.Web.Http Runtime.Process RequestNoDemand
System.Web.dll! System.Web.Http Runtime.Process Request
WebDev.WebHost. dll!Microsoft.V isualStudio.Web Host.Request.Pr ocess
WebDev.WebHost. dll!Microsoft.V isualStudio.Web Host.Host.Proce ssRequest
[Appdomain Transition]
WebDev.WebHost. dll!Microsoft.V isualStudio.Web Host.Server.OnS ocketAccept
mscorlib.dll!Sy stem.Threading. _ThreadPoolWait Callback.WaitCa llback_Context
mscorlib.dll!Sy stem.Threading. ExecutionContex t.Run
mscorlib.dll!Sy stem.Threading. _ThreadPoolWait Callback.Perfor mWaitCallback

Function:
Coordinators_Us erControls_Supp ort_POS.sqldsSu pportInfo_Selec ted(object,
System.Web.UI.W ebControls.SqlD ataSourceStatus EventArgs), Thread: 0xF40 <No
Name>, Stack:
App_Web_irip9ki 6.dll!Coordinat ors_UserControl s_Support_POS.s qldsSupportInfo _Selected
System.Web.dll! System.Web.UI.W ebControls.SqlD ataSourceView.O nSelected
System.Web.dll! System.Web.UI.W ebControls.SqlD ataSourceView.E xecuteSelect
System.Web.dll! System.Web.UI.W ebControls.Base DataList.GetDat a
System.Web.dll! System.Web.UI.W ebControls.Data List.CreateCont rolHierarchy
System.Web.dll! System.Web.UI.W ebControls.Base DataList.OnData Binding
System.Web.dll! System.Web.UI.W ebControls.Base DataList.DataBi nd
System.Web.dll! System.Web.UI.W ebControls.Base DataList.Ensure DataBound
System.Web.dll! System.Web.UI.W ebControls.Base DataList.OnPreR ender
System.Web.dll! System.Web.UI.C ontrol.PreRende rRecursiveInter nal
System.Web.dll! System.Web.UI.C ontrol.PreRende rRecursiveInter nal
System.Web.dll! System.Web.UI.C ontrol.PreRende rRecursiveInter nal
System.Web.dll! System.Web.UI.C ontrol.PreRende rRecursiveInter nal
System.Web.dll! System.Web.UI.C ontrol.PreRende rRecursiveInter nal
System.Web.dll! System.Web.UI.C ontrol.PreRende rRecursiveInter nal
System.Web.dll! System.Web.UI.C ontrol.PreRende rRecursiveInter nal
System.Web.dll! System.Web.UI.P age.ProcessRequ estMain
System.Web.dll! System.Web.UI.P age.ProcessRequ est
System.Web.dll! System.Web.UI.P age.ProcessRequ est
System.Web.dll! System.Web.UI.P age.ProcessRequ estWithNoAssert
System.Web.dll! System.Web.UI.P age.ProcessRequ est
App_Web_w8u2q5z q.dll!ASP.coord inators_coordin atorsportal_asp x.ProcessReques t
System.Web.dll! System.Web.Http Application.Cal lHandlerExecuti onStep.System.W eb.HttpApplicat ion.IExecutionS tep.Execute
System.Web.dll! System.Web.Http Application.Exe cuteStep
System.Web.dll! System.Web.Http Application.Res umeSteps
System.Web.dll! System.Web.Http Application.Sys tem.Web.IHttpAs yncHandler.Begi nProcessRequest
System.Web.dll! System.Web.Http Runtime.Process RequestInternal
System.Web.dll! System.Web.Http Runtime.Process RequestNow
System.Web.dll! System.Web.Http Runtime.Process RequestNoDemand
System.Web.dll! System.Web.Http Runtime.Process Request
WebDev.WebHost. dll!Microsoft.V isualStudio.Web Host.Request.Pr ocess
WebDev.WebHost. dll!Microsoft.V isualStudio.Web Host.Host.Proce ssRequest
[Appdomain Transition]
WebDev.WebHost. dll!Microsoft.V isualStudio.Web Host.Server.OnS ocketAccept
mscorlib.dll!Sy stem.Threading. _ThreadPoolWait Callback.WaitCa llback_Context
mscorlib.dll!Sy stem.Threading. ExecutionContex t.Run
mscorlib.dll!Sy stem.Threading. _ThreadPoolWait Callback.Perfor mWaitCallback

Call stacks are different here:
First:
System.Web.dll! System.Web.UI.W ebControls.Base DataList.Ensure DataBound
System.Web.dll! System.Web.UI.W ebControls.Base DataList.Create ChildControls
System.Web.dll! System.Web.UI.C ontrol.EnsureCh ildControls
Secondo:
System.Web.dll! System.Web.UI.W ebControls.Base DataList.Ensure DataBound
System.Web.dll! System.Web.UI.W ebControls.Base DataList.OnPreR ender
It seems like EnsureDataBound metod doesnt feel that datalist has already
bounded data.

Please help
pb
Jun 27 '08 #1
0 1083

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

Similar topics

4
4013
by: Peter Lin | last post by:
Dear all; I need to monitor a xml file so that I can update my data in hashtable, but the problem is it will trigger more than one event for a lastwrite action(I trigger this action by add something in the xml file using notepad). Here is my codes about using FilesystemWatcher fileWatcher=new FileSystemWatcher(); fileWatcher.Path=System.Environment.CurrentDirectory; fileWatcher.NotifyFilter=NotifyFilters.LastWrite;
2
322
by: Charles Law | last post by:
I may have asked this before, but what is the purpose of both these functions? Is there a time when one should be called over the other? Does one supersede the other, or do they both have their time and place? TIA Charles
4
7846
by: Johnnie Miami | last post by:
I'm using VB.Net 2005 beta 2 and have my login form (login.vb) specified as the startup form. If the user is successful logging in, I call my main form (main.vb). This all works fine but the problem is that the login form stays open. I put a me.close (in the login form) after opening the main form but that seems to close everything and the main form is not displayed. I thought I could call a Sub Main() that calls the login form, closes...
0
1763
by: engsolnorm | last post by:
A co-worker and I want to increase our knowledge of Python. I have a tiny bit of exposure to python. He has none, but has wide experience with C, C++, NET, C#, etc. We agreed we'd do a Sudoku solver. I'd do the GUI, he would do the solver code. My question is this: I assume that once I invoke mauinloop, the loop just cycles between bound events...(if not true, please tell me)...so how do I "branch" out to the solver code, which will be in...
2
4612
by: Michael Moreno | last post by:
Hello, In a Base Form I have a toolbar and have implemented the Click event as: protected virtual void toolBar1_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e) { if (e.Button == tbClose) Close();
2
1892
by: Anup | last post by:
Hi Group, In my application I am using a datagrid, now I m implementing sorting for that datagrid, I am changing the flag for ascending and descending when SortCommand event of datagrid is fired. Now the problem I am facing is that the Sort Command event is being fired twice even if I click the header in datagrid only once thus my flag is getting reset to the original value.
3
10041
by: Han | last post by:
Hello I am experiencing duplicate Page_PreRenderComplete events. I am using webservice in async mode. Skeleton is, class class1: System.Web.UI.Page {
4
1259
by: Samuel Shulman | last post by:
Hi Can anyone explain why the Load Even is raised twice in the web page? What can be done to avoid it? Thanks, Samuel
4
4504
by: chris.c.woodward | last post by:
This event seems to be being raised twice in my codebehind. I have only one SelectMethod and do not have a SelectCountMethod. Its causing a problem because I'm dynamically loading a user control into a PlaceHolder control in the method and am having to do a check to see if it already exists or not otherwise it gets loaded twice. Also it would be nice to figure out what the heck is going on! Here is the code ... protected void...
0
8481
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8400
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
8924
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
8823
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
8602
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
8672
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...
0
7441
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6234
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...
1
2817
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.