Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Call a Stored ProcedureCall a Stored Procedure
Previous
 
Next
New Post
10/19/2007 12:03 AM
 

AdefWebserver wrote

Also, this might help:

http://www.adefwebserver.com/DotNetNukeHELP/DNN_Things4Sale/

It explains how to use the Object Data Source conrol with a DotNetNuke module.

That tutorial is spot-on, Michael!

 

 
New Post
10/19/2007 9:53 AM
 

Algorithm0,

I actually am already using parts of this example module.
The module works fine when using the object data source for editing and deleting, but the GridView starts blank (doesn't bind the existing table data).
There is SELECTALL code within the controller.vb as well:
<DataObjectMethod(DataObjectMethodType.Select)> _
Public Shared Function ModuleName_SelectAll(ByVal ModuleId As Integer) As List(Of ModuleNameInfo)
Return CBO.FillCollection(Of ModuleNameInfo)(CType(DataProvider.Instance().ExecuteReader("ModuleName_SelectAll", ModuleId), IDataReader))
End Function
but I am not sure how to execute it, or if it will actually grab all the existing table data.

In addition to this concern, I cannot find where/how ModuleName_SelectAll, ModuleName_Insert,  or ModuleName_Delete are being called. (and they are stored procedures...how would I execute these?)

Feedback Appreciated,

-machina12

 
New Post
10/19/2007 10:20 AM
 

If you in fact have the ObjectDataSource instance wired up to all three of your controller's methods (select,delete,update), then you need to make sure there is no code elsewhere that is wiping out the data when your page first runs ( inside an If Not IsPostBack block, perhaps)...

However, I get the vibe that you're missing some essential understanding of how the GridView and ObjectDataSource function. These controls exist so that you don't have to manually call ModuleName_SelectAll, ModuleName_Delete, etc...

FROM MICHAEL'S TUTORIAL:

<asp:ObjectDataSource ID="ObjectDataSource_ThingsForSale" runat="server" DataObjectTypeName="YourCompany.Modules.ThingsForSale.ThingsForSaleInfo"
DeleteMethod
="ThingsForSale_Delete" InsertMethod="ThingsForSale_Insert" OldValuesParameterFormatString="original_{0}"
OnInit
="Page_Load" SelectMethod="ThingsForSale_SelectAll" TypeName="YourCompany.Modules.ThingsForSale.ThingsForSaleController"
UpdateMethod
="ThingsForSale_Update">
<
SelectParameters>
<
asp:Parameter DefaultValue="00" Name="ModuleId" Type="Int32" />
</
SelectParameters>
</
asp:ObjectDataSource>

Those large attributes above are what cause the methods on your controller to execute when the GridView needs to delete, update, or select data. In turn the controller method that the ObjectDataSource calls will execute the stored procedures. In your  controller's select method it executes: DataProvider.Instance().ExecuteReader("ModuleName_SelectAll", ModuleId)

Does this help you at all?

 

 
New Post
10/19/2007 11:26 AM
 

Alogorith0,

Appreciate the knowledge. I had already analyzed the .ascx file to see the code above.
My problem is that the Gridview doesn't aleady load existing data in sql table.

1.) Does this code within "ModuleName_SelectAll" appear to have syntax to select all existing data?

2.) How do I call/execute the "ModuleName_SelectAll" within the .vb file?
 

3.) How do I associate it with only GridView3?

4.) Where can I dictate/change the sql table it is "selecting all" from?


-machina12

 
New Post
10/19/2007 11:50 AM
 

>1.) Does this code within "ModuleName_SelectAll" appear to have syntax to select all existing data?

This method executes the ModuleName_SelectAll stored procedure which (should) reside in you database. You can execute this stored procedure through the server explorer window in VS or VWD to see that it does in fact return what you expect.

> 2.) How do I call/execute the "ModuleName_SelectAll" within the .vb file?

If you want to call the stored procedure then use DataProvider.Instance().ExecuteReader("ModuleName_SelectAll", ModuleId)

If you want to call the method on your controller just call it.

You shouldn't have to manually do either of these. The ObjectDataSource will do all the calling for you.

> 3.) How do I associate it with only GridView3?

Give GridView3 its own ObjectDataSource instance. You can then assign whatever select, insert, update, delete methods you want to asign to that ObjectDataSource.

>4.) Where can I dictate/change the sql table it is "selecting all" from?

Within your stored procedure which is in your database.

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Call a Stored ProcedureCall a Stored Procedure


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out