473,511 Members | 16,983 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:DropDownList ID="ddlConversionDates" runat="server"
AutoPostBack="True" DataSourceID="sqldsConversionDates"
DataTextField="ConversionDate"
DataValueField="ConversionDate">
</asp:DropDownList>
<asp:SqlDataSource ID="sqldsConversionDates" runat="server"
ConnectionString="<%$ ConnectionStrings:dbConnectionString %>"
SelectCommand="owrsp_GetConversionDatesForPOS"
SelectCommandType="StoredProcedure"
DataSourceMode="DataReader">
<SelectParameters>
<asp:Parameter Name="jo" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
</td>
</tr>
<tr>
<td style="width: 5%;">
</td>
<td colspan="3">
<asp:Label ID="lSupportInfo" runat="server" Text=""
Visible="false" Font-Size="14px"
Font-Bold="true" Width="100%"></asp:Label>
<asp:DataList ID="dlSupportInfo" runat="server"
DataKeyField="ProfileID" DataSourceID="sqldsSupportInfo"
Width="100%" RepeatDirection="Horizontal" ShowFooter="False"
ShowHeader="False"
CssClass="dataTable" CellSpacing="-1"
OnPreRender="dlSupportInfo_PreRender">
<ItemTemplate>
<asp:Label Font-Bold="true" ID="ProfileIDLabel"
runat="server" Text='<%# Eval("ProfileID") %>'
ToolTip='<%# "Profil: " + Eval("Name") +
Environment.NewLine + Eval("Description") %>'></asp:Label><br />
<asp:Label ID="SupportLabel" runat="server" Text='<%#
Eval("Support") + " / " + Eval("Need") %>'
ToolTip=""></asp:Label><br />
</ItemTemplate>
</asp:DataList>
<asp:SqlDataSource ID="sqldsSupportInfo" runat="server"
ConnectionString="<%$ ConnectionStrings:dbConnectionString %>"
SelectCommand="owrsp_GetInfoForSupportPOSNeed"
SelectCommandType="StoredProcedure"
DataSourceMode="DataReader"
OnSelected="sqldsSupportInfo_Selected">
<SelectParameters>
<asp:Parameter Name="jo" Type="String" />
<asp:ControlParameter ControlID="ddlConversionDates"
Name="conversionDate" PropertyName="SelectedValue"
Type="DateTime" />
</SelectParameters>
</asp:SqlDataSource>
</td>
</tr>

Here i set jo params i page load:

protected void Page_Load(object sender, EventArgs e)
{
//getting JO of updating POS
NavigatorItem selectedItem = (NavigatorItem)Parameters["Item"];
unitName = selectedItem.Text;
GetSelectedItemJO(selectedItem);

//setting parameters of controls
sqldsConversionDates.SelectParameters["jo"].DefaultValue = jo;
sqldsSupportInfo.SelectParameters["jo"].DefaultValue = jo;
}

This is call trace:
Function:
Coordinators_UserControls_Support_POS.sqldsSupport Info_Selected(object,
System.Web.UI.WebControls.SqlDataSourceStatusEvent Args), Thread: 0xF40 <No
Name>, Stack:
App_Web_irip9ki6.dll!Coordinators_UserControls_Sup port_POS.sqldsSupportInfo_Selected
System.Web.dll!System.Web.UI.WebControls.SqlDataSo urceView.OnSelected
System.Web.dll!System.Web.UI.WebControls.SqlDataSo urceView.ExecuteSelect
System.Web.dll!System.Web.UI.WebControls.BaseDataL ist.GetData
System.Web.dll!System.Web.UI.WebControls.DataList. CreateControlHierarchy
System.Web.dll!System.Web.UI.WebControls.BaseDataL ist.OnDataBinding
System.Web.dll!System.Web.UI.WebControls.BaseDataL ist.DataBind
System.Web.dll!System.Web.UI.WebControls.BaseDataL ist.EnsureDataBound
System.Web.dll!System.Web.UI.WebControls.BaseDataL ist.CreateChildControls
System.Web.dll!System.Web.UI.Control.EnsureChildCo ntrols
System.Web.dll!System.Web.UI.Control.PreRenderRecu rsiveInternal
System.Web.dll!System.Web.UI.Control.PreRenderRecu rsiveInternal
System.Web.dll!System.Web.UI.Control.PreRenderRecu rsiveInternal
System.Web.dll!System.Web.UI.Control.PreRenderRecu rsiveInternal
System.Web.dll!System.Web.UI.Control.PreRenderRecu rsiveInternal
System.Web.dll!System.Web.UI.Control.PreRenderRecu rsiveInternal
System.Web.dll!System.Web.UI.Control.PreRenderRecu rsiveInternal
System.Web.dll!System.Web.UI.Page.ProcessRequestMa in
System.Web.dll!System.Web.UI.Page.ProcessRequest
System.Web.dll!System.Web.UI.Page.ProcessRequest
System.Web.dll!System.Web.UI.Page.ProcessRequestWi thNoAssert
System.Web.dll!System.Web.UI.Page.ProcessRequest
App_Web_w8u2q5zq.dll!ASP.coordinators_coordinators portal_aspx.ProcessRequest
System.Web.dll!System.Web.HttpApplication.CallHand lerExecutionStep.System.Web.HttpApplication.IExecu tionStep.Execute
System.Web.dll!System.Web.HttpApplication.ExecuteS tep
System.Web.dll!System.Web.HttpApplication.ResumeSt eps
System.Web.dll!System.Web.HttpApplication.System.W eb.IHttpAsyncHandler.BeginProcessRequest
System.Web.dll!System.Web.HttpRuntime.ProcessReque stInternal
System.Web.dll!System.Web.HttpRuntime.ProcessReque stNow
System.Web.dll!System.Web.HttpRuntime.ProcessReque stNoDemand
System.Web.dll!System.Web.HttpRuntime.ProcessReque st
WebDev.WebHost.dll!Microsoft.VisualStudio.WebHost. Request.Process
WebDev.WebHost.dll!Microsoft.VisualStudio.WebHost. Host.ProcessRequest
[Appdomain Transition]
WebDev.WebHost.dll!Microsoft.VisualStudio.WebHost. Server.OnSocketAccept
mscorlib.dll!System.Threading._ThreadPoolWaitCallb ack.WaitCallback_Context
mscorlib.dll!System.Threading.ExecutionContext.Run
mscorlib.dll!System.Threading._ThreadPoolWaitCallb ack.PerformWaitCallback

Function:
Coordinators_UserControls_Support_POS.sqldsSupport Info_Selected(object,
System.Web.UI.WebControls.SqlDataSourceStatusEvent Args), Thread: 0xF40 <No
Name>, Stack:
App_Web_irip9ki6.dll!Coordinators_UserControls_Sup port_POS.sqldsSupportInfo_Selected
System.Web.dll!System.Web.UI.WebControls.SqlDataSo urceView.OnSelected
System.Web.dll!System.Web.UI.WebControls.SqlDataSo urceView.ExecuteSelect
System.Web.dll!System.Web.UI.WebControls.BaseDataL ist.GetData
System.Web.dll!System.Web.UI.WebControls.DataList. CreateControlHierarchy
System.Web.dll!System.Web.UI.WebControls.BaseDataL ist.OnDataBinding
System.Web.dll!System.Web.UI.WebControls.BaseDataL ist.DataBind
System.Web.dll!System.Web.UI.WebControls.BaseDataL ist.EnsureDataBound
System.Web.dll!System.Web.UI.WebControls.BaseDataL ist.OnPreRender
System.Web.dll!System.Web.UI.Control.PreRenderRecu rsiveInternal
System.Web.dll!System.Web.UI.Control.PreRenderRecu rsiveInternal
System.Web.dll!System.Web.UI.Control.PreRenderRecu rsiveInternal
System.Web.dll!System.Web.UI.Control.PreRenderRecu rsiveInternal
System.Web.dll!System.Web.UI.Control.PreRenderRecu rsiveInternal
System.Web.dll!System.Web.UI.Control.PreRenderRecu rsiveInternal
System.Web.dll!System.Web.UI.Control.PreRenderRecu rsiveInternal
System.Web.dll!System.Web.UI.Page.ProcessRequestMa in
System.Web.dll!System.Web.UI.Page.ProcessRequest
System.Web.dll!System.Web.UI.Page.ProcessRequest
System.Web.dll!System.Web.UI.Page.ProcessRequestWi thNoAssert
System.Web.dll!System.Web.UI.Page.ProcessRequest
App_Web_w8u2q5zq.dll!ASP.coordinators_coordinators portal_aspx.ProcessRequest
System.Web.dll!System.Web.HttpApplication.CallHand lerExecutionStep.System.Web.HttpApplication.IExecu tionStep.Execute
System.Web.dll!System.Web.HttpApplication.ExecuteS tep
System.Web.dll!System.Web.HttpApplication.ResumeSt eps
System.Web.dll!System.Web.HttpApplication.System.W eb.IHttpAsyncHandler.BeginProcessRequest
System.Web.dll!System.Web.HttpRuntime.ProcessReque stInternal
System.Web.dll!System.Web.HttpRuntime.ProcessReque stNow
System.Web.dll!System.Web.HttpRuntime.ProcessReque stNoDemand
System.Web.dll!System.Web.HttpRuntime.ProcessReque st
WebDev.WebHost.dll!Microsoft.VisualStudio.WebHost. Request.Process
WebDev.WebHost.dll!Microsoft.VisualStudio.WebHost. Host.ProcessRequest
[Appdomain Transition]
WebDev.WebHost.dll!Microsoft.VisualStudio.WebHost. Server.OnSocketAccept
mscorlib.dll!System.Threading._ThreadPoolWaitCallb ack.WaitCallback_Context
mscorlib.dll!System.Threading.ExecutionContext.Run
mscorlib.dll!System.Threading._ThreadPoolWaitCallb ack.PerformWaitCallback

Call stacks are different here:
First:
System.Web.dll!System.Web.UI.WebControls.BaseDataL ist.EnsureDataBound
System.Web.dll!System.Web.UI.WebControls.BaseDataL ist.CreateChildControls
System.Web.dll!System.Web.UI.Control.EnsureChildCo ntrols
Secondo:
System.Web.dll!System.Web.UI.WebControls.BaseDataL ist.EnsureDataBound
System.Web.dll!System.Web.UI.WebControls.BaseDataL ist.OnPreRender
It seems like EnsureDataBound metod doesnt feel that datalist has already
bounded data.

Please help
pb
Jun 27 '08 #1
0 1066

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

Similar topics

4
4002
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...
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...
4
7824
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...
0
1751
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...
2
4606
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)...
2
1889
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...
3
10030
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
1252
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
4491
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...
0
7144
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...
1
7085
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...
0
7512
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...
0
5671
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,...
1
5069
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...
0
4741
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...
0
3227
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3214
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
449
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.