B
Bieniu
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">
<aspropDownList ID="ddlConversionDates" runat="server"
AutoPostBack="True" DataSourceID="sqldsConversionDates"
DataTextField="ConversionDate"
DataValueField="ConversionDate">
</aspropDownList>
<asp:SqlDataSource ID="sqldsConversionDates" runat="server"
ConnectionString="<%$ ConnectionStrings:dbConnectionString %>"
SelectCommand="owrsp_GetConversionDatesForPOS"
SelectCommandType="StoredProcedure"
DataSourceMode="DataReader">
<SelectParameters>
<asparameter 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>
<aspataList 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>
</aspataList>
<asp:SqlDataSource ID="sqldsSupportInfo" runat="server"
ConnectionString="<%$ ConnectionStrings:dbConnectionString %>"
SelectCommand="owrsp_GetInfoForSupportPOSNeed"
SelectCommandType="StoredProcedure"
DataSourceMode="DataReader"
OnSelected="sqldsSupportInfo_Selected">
<SelectParameters>
<asparameter 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.sqldsSupportInfo_Selected(object,
System.Web.UI.WebControls.SqlDataSourceStatusEventArgs), Thread: 0xF40 <No
Name>, Stack:
App_Web_irip9ki6.dll!Coordinators_UserControls_Support_POS.sqldsSupportInfo_Selected
System.Web.dll!System.Web.UI.WebControls.SqlDataSourceView.OnSelected
System.Web.dll!System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect
System.Web.dll!System.Web.UI.WebControls.BaseDataList.GetData
System.Web.dll!System.Web.UI.WebControls.DataList.CreateControlHierarchy
System.Web.dll!System.Web.UI.WebControls.BaseDataList.OnDataBinding
System.Web.dll!System.Web.UI.WebControls.BaseDataList.DataBind
System.Web.dll!System.Web.UI.WebControls.BaseDataList.EnsureDataBound
System.Web.dll!System.Web.UI.WebControls.BaseDataList.CreateChildControls
System.Web.dll!System.Web.UI.Control.EnsureChildControls
System.Web.dll!System.Web.UI.Control.PreRenderRecursiveInternal
System.Web.dll!System.Web.UI.Control.PreRenderRecursiveInternal
System.Web.dll!System.Web.UI.Control.PreRenderRecursiveInternal
System.Web.dll!System.Web.UI.Control.PreRenderRecursiveInternal
System.Web.dll!System.Web.UI.Control.PreRenderRecursiveInternal
System.Web.dll!System.Web.UI.Control.PreRenderRecursiveInternal
System.Web.dll!System.Web.UI.Control.PreRenderRecursiveInternal
System.Web.dll!System.Web.UI.Page.ProcessRequestMain
System.Web.dll!System.Web.UI.Page.ProcessRequest
System.Web.dll!System.Web.UI.Page.ProcessRequest
System.Web.dll!System.Web.UI.Page.ProcessRequestWithNoAssert
System.Web.dll!System.Web.UI.Page.ProcessRequest
App_Web_w8u2q5zq.dll!ASP.coordinators_coordinatorsportal_aspx.ProcessRequest
System.Web.dll!System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute
System.Web.dll!System.Web.HttpApplication.ExecuteStep
System.Web.dll!System.Web.HttpApplication.ResumeSteps
System.Web.dll!System.Web.HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest
System.Web.dll!System.Web.HttpRuntime.ProcessRequestInternal
System.Web.dll!System.Web.HttpRuntime.ProcessRequestNow
System.Web.dll!System.Web.HttpRuntime.ProcessRequestNoDemand
System.Web.dll!System.Web.HttpRuntime.ProcessRequest
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._ThreadPoolWaitCallback.WaitCallback_Context
mscorlib.dll!System.Threading.ExecutionContext.Run
mscorlib.dll!System.Threading._ThreadPoolWaitCallback.PerformWaitCallback
Function:
Coordinators_UserControls_Support_POS.sqldsSupportInfo_Selected(object,
System.Web.UI.WebControls.SqlDataSourceStatusEventArgs), Thread: 0xF40 <No
Name>, Stack:
App_Web_irip9ki6.dll!Coordinators_UserControls_Support_POS.sqldsSupportInfo_Selected
System.Web.dll!System.Web.UI.WebControls.SqlDataSourceView.OnSelected
System.Web.dll!System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect
System.Web.dll!System.Web.UI.WebControls.BaseDataList.GetData
System.Web.dll!System.Web.UI.WebControls.DataList.CreateControlHierarchy
System.Web.dll!System.Web.UI.WebControls.BaseDataList.OnDataBinding
System.Web.dll!System.Web.UI.WebControls.BaseDataList.DataBind
System.Web.dll!System.Web.UI.WebControls.BaseDataList.EnsureDataBound
System.Web.dll!System.Web.UI.WebControls.BaseDataList.OnPreRender
System.Web.dll!System.Web.UI.Control.PreRenderRecursiveInternal
System.Web.dll!System.Web.UI.Control.PreRenderRecursiveInternal
System.Web.dll!System.Web.UI.Control.PreRenderRecursiveInternal
System.Web.dll!System.Web.UI.Control.PreRenderRecursiveInternal
System.Web.dll!System.Web.UI.Control.PreRenderRecursiveInternal
System.Web.dll!System.Web.UI.Control.PreRenderRecursiveInternal
System.Web.dll!System.Web.UI.Control.PreRenderRecursiveInternal
System.Web.dll!System.Web.UI.Page.ProcessRequestMain
System.Web.dll!System.Web.UI.Page.ProcessRequest
System.Web.dll!System.Web.UI.Page.ProcessRequest
System.Web.dll!System.Web.UI.Page.ProcessRequestWithNoAssert
System.Web.dll!System.Web.UI.Page.ProcessRequest
App_Web_w8u2q5zq.dll!ASP.coordinators_coordinatorsportal_aspx.ProcessRequest
System.Web.dll!System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute
System.Web.dll!System.Web.HttpApplication.ExecuteStep
System.Web.dll!System.Web.HttpApplication.ResumeSteps
System.Web.dll!System.Web.HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest
System.Web.dll!System.Web.HttpRuntime.ProcessRequestInternal
System.Web.dll!System.Web.HttpRuntime.ProcessRequestNow
System.Web.dll!System.Web.HttpRuntime.ProcessRequestNoDemand
System.Web.dll!System.Web.HttpRuntime.ProcessRequest
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._ThreadPoolWaitCallback.WaitCallback_Context
mscorlib.dll!System.Threading.ExecutionContext.Run
mscorlib.dll!System.Threading._ThreadPoolWaitCallback.PerformWaitCallback
Call stacks are different here:
First:
System.Web.dll!System.Web.UI.WebControls.BaseDataList.EnsureDataBound
System.Web.dll!System.Web.UI.WebControls.BaseDataList.CreateChildControls
System.Web.dll!System.Web.UI.Control.EnsureChildControls
Secondo:
System.Web.dll!System.Web.UI.WebControls.BaseDataList.EnsureDataBound
System.Web.dll!System.Web.UI.WebControls.BaseDataList.OnPreRender
It seems like EnsureDataBound metod doesnt feel that datalist has already
bounded data.
Please help
pb
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">
<aspropDownList ID="ddlConversionDates" runat="server"
AutoPostBack="True" DataSourceID="sqldsConversionDates"
DataTextField="ConversionDate"
DataValueField="ConversionDate">
</aspropDownList>
<asp:SqlDataSource ID="sqldsConversionDates" runat="server"
ConnectionString="<%$ ConnectionStrings:dbConnectionString %>"
SelectCommand="owrsp_GetConversionDatesForPOS"
SelectCommandType="StoredProcedure"
DataSourceMode="DataReader">
<SelectParameters>
<asparameter 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>
<aspataList 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>
</aspataList>
<asp:SqlDataSource ID="sqldsSupportInfo" runat="server"
ConnectionString="<%$ ConnectionStrings:dbConnectionString %>"
SelectCommand="owrsp_GetInfoForSupportPOSNeed"
SelectCommandType="StoredProcedure"
DataSourceMode="DataReader"
OnSelected="sqldsSupportInfo_Selected">
<SelectParameters>
<asparameter 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.sqldsSupportInfo_Selected(object,
System.Web.UI.WebControls.SqlDataSourceStatusEventArgs), Thread: 0xF40 <No
Name>, Stack:
App_Web_irip9ki6.dll!Coordinators_UserControls_Support_POS.sqldsSupportInfo_Selected
System.Web.dll!System.Web.UI.WebControls.SqlDataSourceView.OnSelected
System.Web.dll!System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect
System.Web.dll!System.Web.UI.WebControls.BaseDataList.GetData
System.Web.dll!System.Web.UI.WebControls.DataList.CreateControlHierarchy
System.Web.dll!System.Web.UI.WebControls.BaseDataList.OnDataBinding
System.Web.dll!System.Web.UI.WebControls.BaseDataList.DataBind
System.Web.dll!System.Web.UI.WebControls.BaseDataList.EnsureDataBound
System.Web.dll!System.Web.UI.WebControls.BaseDataList.CreateChildControls
System.Web.dll!System.Web.UI.Control.EnsureChildControls
System.Web.dll!System.Web.UI.Control.PreRenderRecursiveInternal
System.Web.dll!System.Web.UI.Control.PreRenderRecursiveInternal
System.Web.dll!System.Web.UI.Control.PreRenderRecursiveInternal
System.Web.dll!System.Web.UI.Control.PreRenderRecursiveInternal
System.Web.dll!System.Web.UI.Control.PreRenderRecursiveInternal
System.Web.dll!System.Web.UI.Control.PreRenderRecursiveInternal
System.Web.dll!System.Web.UI.Control.PreRenderRecursiveInternal
System.Web.dll!System.Web.UI.Page.ProcessRequestMain
System.Web.dll!System.Web.UI.Page.ProcessRequest
System.Web.dll!System.Web.UI.Page.ProcessRequest
System.Web.dll!System.Web.UI.Page.ProcessRequestWithNoAssert
System.Web.dll!System.Web.UI.Page.ProcessRequest
App_Web_w8u2q5zq.dll!ASP.coordinators_coordinatorsportal_aspx.ProcessRequest
System.Web.dll!System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute
System.Web.dll!System.Web.HttpApplication.ExecuteStep
System.Web.dll!System.Web.HttpApplication.ResumeSteps
System.Web.dll!System.Web.HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest
System.Web.dll!System.Web.HttpRuntime.ProcessRequestInternal
System.Web.dll!System.Web.HttpRuntime.ProcessRequestNow
System.Web.dll!System.Web.HttpRuntime.ProcessRequestNoDemand
System.Web.dll!System.Web.HttpRuntime.ProcessRequest
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._ThreadPoolWaitCallback.WaitCallback_Context
mscorlib.dll!System.Threading.ExecutionContext.Run
mscorlib.dll!System.Threading._ThreadPoolWaitCallback.PerformWaitCallback
Function:
Coordinators_UserControls_Support_POS.sqldsSupportInfo_Selected(object,
System.Web.UI.WebControls.SqlDataSourceStatusEventArgs), Thread: 0xF40 <No
Name>, Stack:
App_Web_irip9ki6.dll!Coordinators_UserControls_Support_POS.sqldsSupportInfo_Selected
System.Web.dll!System.Web.UI.WebControls.SqlDataSourceView.OnSelected
System.Web.dll!System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect
System.Web.dll!System.Web.UI.WebControls.BaseDataList.GetData
System.Web.dll!System.Web.UI.WebControls.DataList.CreateControlHierarchy
System.Web.dll!System.Web.UI.WebControls.BaseDataList.OnDataBinding
System.Web.dll!System.Web.UI.WebControls.BaseDataList.DataBind
System.Web.dll!System.Web.UI.WebControls.BaseDataList.EnsureDataBound
System.Web.dll!System.Web.UI.WebControls.BaseDataList.OnPreRender
System.Web.dll!System.Web.UI.Control.PreRenderRecursiveInternal
System.Web.dll!System.Web.UI.Control.PreRenderRecursiveInternal
System.Web.dll!System.Web.UI.Control.PreRenderRecursiveInternal
System.Web.dll!System.Web.UI.Control.PreRenderRecursiveInternal
System.Web.dll!System.Web.UI.Control.PreRenderRecursiveInternal
System.Web.dll!System.Web.UI.Control.PreRenderRecursiveInternal
System.Web.dll!System.Web.UI.Control.PreRenderRecursiveInternal
System.Web.dll!System.Web.UI.Page.ProcessRequestMain
System.Web.dll!System.Web.UI.Page.ProcessRequest
System.Web.dll!System.Web.UI.Page.ProcessRequest
System.Web.dll!System.Web.UI.Page.ProcessRequestWithNoAssert
System.Web.dll!System.Web.UI.Page.ProcessRequest
App_Web_w8u2q5zq.dll!ASP.coordinators_coordinatorsportal_aspx.ProcessRequest
System.Web.dll!System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute
System.Web.dll!System.Web.HttpApplication.ExecuteStep
System.Web.dll!System.Web.HttpApplication.ResumeSteps
System.Web.dll!System.Web.HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest
System.Web.dll!System.Web.HttpRuntime.ProcessRequestInternal
System.Web.dll!System.Web.HttpRuntime.ProcessRequestNow
System.Web.dll!System.Web.HttpRuntime.ProcessRequestNoDemand
System.Web.dll!System.Web.HttpRuntime.ProcessRequest
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._ThreadPoolWaitCallback.WaitCallback_Context
mscorlib.dll!System.Threading.ExecutionContext.Run
mscorlib.dll!System.Threading._ThreadPoolWaitCallback.PerformWaitCallback
Call stacks are different here:
First:
System.Web.dll!System.Web.UI.WebControls.BaseDataList.EnsureDataBound
System.Web.dll!System.Web.UI.WebControls.BaseDataList.CreateChildControls
System.Web.dll!System.Web.UI.Control.EnsureChildControls
Secondo:
System.Web.dll!System.Web.UI.WebControls.BaseDataList.EnsureDataBound
System.Web.dll!System.Web.UI.WebControls.BaseDataList.OnPreRender
It seems like EnsureDataBound metod doesnt feel that datalist has already
bounded data.
Please help
pb