468,315 Members | 1,428 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,315 developers. It's quick & easy.

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 900

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Charles Law | last post: by
4 posts views Thread by Johnnie Miami | last post: by
2 posts views Thread by Anup | last post: by
3 posts views Thread by Han | last post: by
4 posts views Thread by Samuel Shulman | last post: by
4 posts views Thread by chris.c.woodward | last post: by
reply views Thread by Teichintx | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.