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.0Databound Listboxes?Databound Listboxes?
Previous
 
Next
New Post
8/8/2007 1:39 PM
 



Wondering about Databound Listboxes. 
I have a few Listboxes being used for form completion.  Options are already coded in.

What I am going for is a Listbox designated to only display "ClientName" from a sql table in database.
So, on an insert or deletion of data I can have Listbox refresh, keeping stats updated.

Guessing that the Listbox will need a stored procedure that grabs all "ClientName's". I could add to stored procedures and run off of the existing controller.vb
Just a bit confused on how to call an event to que up the stored procedure, and or activate the controller.vb that already runs ops?

(Keeping in mind, later I would like:   if user clicks on ClientName A + clicks delete button = ClientName A row deleted)



Feedback Appreciated,


-machina12

 
New Post
8/9/2007 2:29 PM
 


Michael Washington
http://ADefWebserver.com
www.ADefHelpDesk.com
A Free Open Source DotNetNuke Help Desk Module
 
New Post
8/10/2007 11:23 AM
 

Michael,

As soon as I imported code, I noticed that the DataProvider & iDataReader had error lines, as well as random code below.Seemed to have issues with a search feature that also uses DataProvider & iDataReader for collection.Also noticed I was using page_load, and maybe both page_load and page_init adds to errors.

Can I run multiple DataProvider Collections in one module? (i hope)

What do you think looks like the problem?

Here is the error it throws:

 

A critical error has occurred.

Both DataSource and DataSourceID are defined on 'ListBox1'. Remove one definition.

This is the imported code:

Private Sub ShowData(ByVal SearchString As String)
Dim mySqlString As New StringBuilder()
mySqlString.Append("SELECT ClientName")
mySqlString.Append("FROM {databaseOwner}{objectQualifier} ModuleName ")
mySqlString.Append("ORDER BY ClientName ASC")
Dim myParam As SqlParameter = New SqlParameter("@SearchString", SqlDbType.VarChar, 150)
myParam.Value = SearchString
Me.GridView2.DataSource = CType(DataProvider.Instance().ExecuteSQL(mySqlString.ToString(), myParam), IDataReader)
Me.GridView2.DataBind()

 The code below that uses a DataProvider & iDataReader is:

 Protected Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.LoadShowData(txtSearch.Text)

Dim mySqlString As New StringBuilder()
mySqlString.Append("SELECT ClientName ")
mySqlString.Append("FROM {databaseOwner}{objectQualifier}iSTORE ")
mySqlString.Append("ORDER BY ClientName")
Me.ListBox1.DataSource = CType(
DataProvider.Instance().ExecuteSQL(mySqlString.ToString(), Nothing), IDataReader)
Me.ListBox1.DataBind()
End Sub

 
New Post
8/10/2007 11:42 AM
 



I got it to work!
Simply deleted ObjectDataSource from listbox within .ascx file.
You can access the exact data you want by leaving the: DataValueField=" "   and sort for your data accordingly.

I guess what throws me off are the squiggly errors within Visual Web Developer.  Are squiggly errors necessarily bad?
Because the module works fine, but has some squiggly error lines.


The next evolution is how to code:  when listbox item is selected + user clicks button (delete) = that complete row of data is deleted.
???


Will be digging for the answer.
Anyone finds it first. Let me know.

Feedback Appreciated,

-machina12

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Databound Listboxes?Databound Listboxes?


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