Annoying problem with event being raised twice

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bieniu

    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


Working...