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.0Access DataList Fields?Access DataList Fields?
Previous
 
Next
New Post
3/31/2008 11:04 AM
 



When trying to template information different than a databound gridview, the core modules seem to use datalists for templated data.  I can rebuild a complex layout of fields, and have all necessary fields bound: <%# Bind("FieldName") %>  ,but  I cannot find where datalist connects with datasource.  Most core files don't give the datasourceID within datalist, and don't reference datalist within controller, etc.?  The template simply doesn't appear for data collection.

 
New Post
3/31/2008 11:21 AM
 



Always good when you can answer your own question.  The datalist needed databind to sql query.

 
New Post
3/31/2008 11:36 AM
 



When attempting to UPDATE a datalist item with linkbutton and SqlParameter, how can I access the datalist fields (textbox, checkboxes, etc.)?

Dim UserParam As SqlParameter = New SqlParameter("@UserParam", SqlDbType.NVarChar, 200)
userParam.Value = Me.DataList1.???

Tested this code to attempt to pull data from datalist field:
userParam.Value = DataList1.Items.Item("TextBox1").ToString()

Throws this error:
System.InvalidCastException: Conversion from string "TextBox2" to type 'Integer' is not valid. ---> System.FormatException: Input string was not in a correct format. at Microsoft.VisualBasic.CompilerServices.Conversions.ParseDouble(String Value, NumberFormatInfo NumberFormat) at Microsoft.VisualBasic.CompilerServices.Conversions.ToInteger(String Value) --- End of inner exception stack trace ---

(But field type is a nvarchar, 200 ???)

 
New Post
3/31/2008 7:33 PM
 

old Mac,

DataList1.Items.Item() only accepts an integer that represents the index of the control you are tying to access. Your passing it a string, hence you conversion from string to integer problem.

 

try this:

 

Dim tb1 As TextBox = CType(DataList1.FindControl("TextBox1"), TextBox)
userParam.Value = tb1.Text.ToString()

--Nathan

 
New Post
4/1/2008 10:19 AM
 



Nathan,

That makes sense.  So, the complete binding portion would look like this?

Dim tb1 As TextBox = CType(DataList1.FindControl("TextBox1"), TextBox)
Dim UpdateParam As SqlParameter = New SqlParameter("@UpdateParam", SqlDbType.NVarChar, 200)
UpdateParam.Value = tb1.Text.ToString()
Me.DataList1.DataSource = CType(DataProvider.Instance().ExecuteSQL(mySqlString.ToString(), UpdateParam, Nothing), IDataReader)
Me.DataList1.DataBind()

Although I am still receiving errors: System.NullReferenceException: Object reference not set to an instance of an object.

Since the ListView is already populating existing data into databound fields, I am looking to have the UPDATE button easily update.  It's obvious this would be easier just using the controller, because I need the UPDATE to only update the corresponding ID.  I have connected the controller, and am getting a strange error I havn't seen before:

A critical error has occurred.
ObjectDataSource 'ObjectDataSource_TableName' could not find a non-generic method 'TableName_SelectAll' that has parameters: ModuleId.

Stored Parameter, NameSpace, Controller, and data stored w/ ModuleId all appear fine, but it mentions Non-Generic & ModuleId?

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Access DataList Fields?Access DataList Fields?


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