ObjectDataSource completely in code behind

  • Thread starter Thread starter Sean
  • Start date Start date
S

Sean

I'm dynamically creating PDFs and trying to create an objectdatasource
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;
ObjectDataSource Appendix1 = new ObjectDataSource();
Appendix1.TypeName = "Appendix1BLL";
Appendix1.SelectMethod = "GetAppendix1ByAppendix1ID";
Appendix1.SelectParameters.Add("Appendix1ID", App1ID);
Appendix1.Select();
--Here's where I need to call the Selected event--

Thanks in advance for your help.

-Sean
 
Hi,

Sean said:
I'm dynamically creating PDFs and trying to create an objectdatasource
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;
ObjectDataSource Appendix1 = new ObjectDataSource();
Appendix1.TypeName = "Appendix1BLL";
Appendix1.SelectMethod = "GetAppendix1ByAppendix1ID";
Appendix1.SelectParameters.Add("Appendix1ID", App1ID);
Appendix1.Select();
--Here's where I need to call the Selected event--

We need more info, what has the PDF generation has to do with databinding?
 
Well, nothing really. The databinding is used to pull information
from a database to use in the PDF. I can't put the objectdatasource
on the page because it screws up the PDF creation, so I need to do it
all in the code behind.

-Sean
 
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(object sender, EventArgs e)
{
...
Appendix1.Selected += new
ObjectDataSourceStatusEventHandler(Appendix1_Selected);
}
void Appendix1_Selected(object sender,
ObjectDataSourceStatusEventArgs e)
{
...
}

-Sean
 
HI ,


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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top