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.0Dynamic SqlDataSource ValuesDynamic SqlDataSource Values
Previous
 
Next
New Post
9/20/2008 3:36 PM
 



How can a SqlDataSource include dynamic inputs? (Ex: Sql Statements, ConnectionString, Etc.)

Here is a sample of what I am looking to acheive (This is the code in question):

<asp:SqlDataSource id="DataSource" Runat="Server" ProviderName="System.Data.SqlClient"
  ConnectionString="Your Connection String Here"
  SelectCommand="SELECT ProductName FROM DatabaseTable WHERE ProductId = '%' + Container.ProductId + '%' "/>
</asp:SqlDataSource>


I am able to pass other values through the aspx page using code like: 
<%# Container.ProductId %>
<%# Container.CategoryName %>
<%# Localization.GetString("Button.Text", LocalResourceFile) %>

Since <%# Container.ProductId %> already is passing values, how can I include this same source within the SqlDataSource?

Feedback Appreciated.

 

 
New Post
9/20/2008 8:04 PM
 

Perhaps consider using this method:

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

rather than the SQL Data Source. It will allow you to do anything you need easily.



Michael Washington
http://ADefWebserver.com
www.ADefHelpDesk.com
A Free Open Source DotNetNuke Help Desk Module
 
New Post
9/21/2008 12:14 PM
 

I am familiar with using these methods, although in this instance I am modifying a .ascx file that has <%@ control %> declaration rather than a <%@ page %> declaration.

The current .ascx file doesn't reference a codeBehind or codeFile value: 
<%@ control language="C#" autoeventwireup="true" inherits="NameofInheritance" %>

When I add "CodeBehind="filename.ascx.cs"" it doesn't seem to be listening to the .cs codebehind file.
When I add "CodeFile="filename.asxc.cs"" the module throws errors.
 

1.  What am I missing to have the .ascx successfully reference an external .cs codebehind?

2.  Can't this also be acheived within <script> of the .ascx file? 
     When testing within <script> I am not getting a response either.
     <script type="c#/text" language="C#" runat="server">
           labeltest.text = "Testing";
     </script>

Feedback Appreciated.

 
New Post
9/21/2008 5:06 PM
 

The tutorial at: http://www.adefwebserver.com/DotNetNukeHELP/DNN_ShowMeThePages/ is a .ascx control. It uses "CodeFile" so I don't know why it would throw an error.



Michael Washington
http://ADefWebserver.com
www.ADefHelpDesk.com
A Free Open Source DotNetNuke Help Desk Module
 
New Post
9/22/2008 10:29 PM
 

The inheritance which is already determined must be the problem, while the source files are compiled into a .dll file.  Since there cannot be 2 <%@ control %> declarations on the same page, how can I reference an additional external codebehind?  Shouldn't <script> within .ascx file work as well?  Is there a way to embedd a .ascx value into SqlDataSource Select Command (initial post)? 

Feedback Appreciated.

 

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Dynamic SqlDataSource ValuesDynamic SqlDataSource Values


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