ObjectDataSource completely in code behind

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

    #1

    ObjectDataSource completely in code behind

    I'm dynamically creating PDFs and trying to create an objectdatasourc e
    completely in the code behind, but I can't figure out how to call the
    selected event. Here's what I have so far...

    string App1ID = 1234;
    ObjectDataSourc e Appendix1 = new ObjectDataSourc e();
    Appendix1.TypeN ame = "Appendix1B LL";
    Appendix1.Selec tMethod = "GetAppendix1By Appendix1ID";
    Appendix1.Selec tParameters.Add ("Appendix1I D", App1ID);
    Appendix1.Selec t();
    --Here's where I need to call the Selected event--

    Thanks in advance for your help.

    -Sean

  • Ignacio Machin \( .NET/ C# MVP \)

    #2
    Re: ObjectDataSourc e completely in code behind

    Hi,

    "Sean" <sean.sims@gmai l.comwrote in message
    news:1186753049 .795821.37010@e 9g2000prf.googl egroups.com...
    I'm dynamically creating PDFs and trying to create an objectdatasourc e
    completely in the code behind, but I can't figure out how to call the
    selected event. Here's what I have so far...
    >
    string App1ID = 1234;
    ObjectDataSourc e Appendix1 = new ObjectDataSourc e();
    Appendix1.TypeN ame = "Appendix1B LL";
    Appendix1.Selec tMethod = "GetAppendix1By Appendix1ID";
    Appendix1.Selec tParameters.Add ("Appendix1I D", App1ID);
    Appendix1.Selec t();
    --Here's where I need to call the Selected event--
    >
    We need more info, what has the PDF generation has to do with databinding?


    Comment

    • Sean

      #3
      Re: ObjectDataSourc e completely in code behind

      Well, nothing really. The databinding is used to pull information
      from a database to use in the PDF. I can't put the objectdatasourc e
      on the page because it screws up the PDF creation, so I need to do it
      all in the code behind.

      -Sean

      On Aug 10, 10:00 am, "Ignacio Machin \( .NET/ C# MVP \)" <machin TA
      laceupsolutions .comwrote:
      Hi,
      >
      "Sean" <sean.s...@gmai l.comwrote in message
      >
      news:1186753049 .795821.37010@e 9g2000prf.googl egroups.com...
      >
      I'm dynamically creating PDFs and trying to create an objectdatasourc e
      completely in the code behind, but I can't figure out how to call the
      selected event. Here's what I have so far...
      >
      string App1ID = 1234;
      ObjectDataSourc e Appendix1 = new ObjectDataSourc e();
      Appendix1.TypeN ame = "Appendix1B LL";
      Appendix1.Selec tMethod = "GetAppendix1By Appendix1ID";
      Appendix1.Selec tParameters.Add ("Appendix1I D", App1ID);
      Appendix1.Selec t();
      --Here's where I need to call the Selected event--
      >
      We need more info, what has the PDF generation has to do with databinding?

      Comment

      • Sean

        #4
        Re: ObjectDataSourc e completely in code behind

        Sometimes pausing to read intellisense is a good idea...

        I came up with the following solution thanks to Visual Studio's magic
        tab completion...

        protected void Page_Load(objec t sender, EventArgs e)
        {
        ...
        Appendix1.Selec ted += new
        ObjectDataSourc eStatusEventHan dler(Appendix1_ Selected);
        }
        void Appendix1_Selec ted(object sender,
        ObjectDataSourc eStatusEventArg s e)
        {
        ...
        }

        -Sean

        On Aug 10, 10:06 am, Sean <sean.s...@gmai l.comwrote:
        Well, nothing really. The databinding is used to pull information
        from a database to use in the PDF. I can't put the objectdatasourc e
        on the page because it screws up the PDF creation, so I need to do it
        all in the code behind.
        >
        -Sean
        >
        On Aug 10, 10:00 am, "Ignacio Machin \( .NET/ C# MVP \)" <machin TA
        >
        laceupsolutions .comwrote:
        Hi,
        >
        "Sean" <sean.s...@gmai l.comwrote in message
        >
        news:1186753049 .795821.37010@e 9g2000prf.googl egroups.com...
        >
        I'm dynamically creating PDFs and trying to create an objectdatasourc e
        completely in the code behind, but I can't figure out how to call the
        selected event. Here's what I have so far...
        >
        string App1ID = 1234;
        ObjectDataSourc e Appendix1 = new ObjectDataSourc e();
        Appendix1.TypeN ame = "Appendix1B LL";
        Appendix1.Selec tMethod = "GetAppendix1By Appendix1ID";
        Appendix1.Selec tParameters.Add ("Appendix1I D", App1ID);
        Appendix1.Selec t();
        --Here's where I need to call the Selected event--
        >
        We need more info, what has the PDF generation has to do with databinding?

        Comment

        • Ignacio Machin \( .NET/ C# MVP \)

          #5
          Re: ObjectDataSourc e completely in code behind

          HI ,


          I still do not see the relationship between them, but if it solved your
          problem then congratz :)


          "Sean" <sean.sims@gmai l.comwrote in message
          news:1186757763 .890370.321660@ x35g2000prf.goo glegroups.com.. .
          Sometimes pausing to read intellisense is a good idea...
          >
          I came up with the following solution thanks to Visual Studio's magic
          tab completion...
          >
          protected void Page_Load(objec t sender, EventArgs e)
          {
          ...
          Appendix1.Selec ted += new
          ObjectDataSourc eStatusEventHan dler(Appendix1_ Selected);
          }
          void Appendix1_Selec ted(object sender,
          ObjectDataSourc eStatusEventArg s e)
          {
          ...
          }
          >
          -Sean
          >
          On Aug 10, 10:06 am, Sean <sean.s...@gmai l.comwrote:
          >Well, nothing really. The databinding is used to pull information
          >from a database to use in the PDF. I can't put the objectdatasourc e
          >on the page because it screws up the PDF creation, so I need to do it
          >all in the code behind.
          >>
          >-Sean
          >>
          >On Aug 10, 10:00 am, "Ignacio Machin \( .NET/ C# MVP \)" <machin TA
          >>
          >laceupsolution s.comwrote:
          Hi,
          >>
          "Sean" <sean.s...@gmai l.comwrote in message
          >>
          >news:118675304 9.795821.37010@ e9g2000prf.goog legroups.com...
          >>
          I'm dynamically creating PDFs and trying to create an
          objectdatasourc e
          completely in the code behind, but I can't figure out how to call the
          selected event. Here's what I have so far...
          >>
          string App1ID = 1234;
          ObjectDataSourc e Appendix1 = new ObjectDataSourc e();
          Appendix1.TypeN ame = "Appendix1B LL";
          Appendix1.Selec tMethod = "GetAppendix1By Appendix1ID";
          Appendix1.Selec tParameters.Add ("Appendix1I D", App1ID);
          Appendix1.Selec t();
          --Here's where I need to call the Selected event--
          >>
          We need more info, what has the PDF generation has to do with
          databinding?
          >
          >

          Comment

          Working...