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

HomeHomeGetting StartedGetting StartedNew to DNN Plat...New to DNN Plat...Linking from one .ascx to another from my datagridLinking from one .ascx to another from my datagrid
Previous
 
Next
New Post
3/30/2011 3:09 AM
 
I am using an .ascx page with a datagrid of inventory.  Originally setup outside of DNN when you click on a row it takes you to a new .ascx that shows the details of that item.  I am struggling to get my datagrid to link to my other .ascx.  Any thoughts?

I have tried a few things to no success and there does not appear to be a lot of documentation on this via internet searches.
I have created both of the files as seperate modules and that did not help.  I am currently taken to my Welcome page when i click the link
 
New Post
3/30/2011 4:25 AM
 
I would suggest that you have a closer look at the way DNN works before trying to force it to do things in ways it was not designed for.

Ultimately, all pages in a DNN site are hosted from a single file - being default.aspx.  The exact content, including the selection of which tab to render and which modules to display are controlled at runtime by the contents of the sites database and the various parameters passed from page request to page request.

So lets assume then that you have a module on a page somewhere in your site, that contains your module to display the datalist at the following URL:

http://mysite.com/mydatalist,aspx

In reality however this is a made up url it does not actually exist anywhere - but is generated dynamically and internally gets converted when needed to something more like:

http://mysite.com/default.asp?tabid=40

And what this does in reality is tell DNN to render the skin and modules associated with tabid 40 -- or page 40 of your site.  Which happens to contain in this case your module to display a datalist.

So to get any other information such as a detail page to display - what you need to do is pass some additional parameters is such a way that makes sense to dnn.

There are a number of ways to do this - but one of the more common is to handle the display of the datalist and the detail page in the same Module.

When you module first opens via a call to  http://mysite.com/mydatalist,aspx there are not additional parameters set - so in your code you would display the datalist.

Now we come to the detail link - in your datalist you would format the actual content of the links something like this:

http://mysite.com/default.asp?tabid=40&dataitem=50 

which can be transformed to DNN friendly urls compliments of NavigateURl

DotNetNuke.Common.Globals.NavigateUrl(this.TabId, "", "dataitem=50")

resulting in a url that looks like this:
http://mysite.com/dataitem/50/mydatalist,aspx

Now in your module you would check for the existance of the query parameter dataitem and if it exists - instead of displaying the datalist instead display the detail information for in this case item 50.

Hope this gives you some food for thought.

Westa
 
New Post
3/30/2011 6:12 AM
 
Wes has given a very good answer to this.

I would just add your second '.ascx' control should be included in your module with a different 'Key'. Like 'ViewRecord' or something.

So when you click on a detail in a grid, the Url you should be creating will be something like
default.aspx?tabid=40&dataitem=50&ctl=ViewRecord

When DNN sees the 'ctl' key in the Url, it knows to load a particular .ascx control from your module package. So it will find the 'ViewRecord' control, and load that up. Your .ascx code should then look up your 'dataitem' using the value of 50 and display it.

If you want that .ascx control to be on a different page, that's OK too, but you'll need to store which tabid that page is in your module settings somewhere, so you can create the Url on the fly to load the other page with that control on it. But I would recommend the first option I outlined as a first step.

 
Previous
 
Next
HomeHomeGetting StartedGetting StartedNew to DNN Plat...New to DNN Plat...Linking from one .ascx to another from my datagridLinking from one .ascx to another from my datagrid


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