Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I cannot get a dataview to sort at all based on the column name!

 

Here is the following code that I'm using:

<code>

lstReturnContact.DataSource = dsRolodexXSD.CONTACTS.Select(dsRolodexXSD.CONTACTS.Columns(1).ToString & " <> ''")

lstReturnContact.ValueMember = dsRolodexXSD.CONTACTS.Columns(0).ToString

lstReturnContact.DisplayMember = dsRolodexXSD.CONTACTS.Columns(1).ToString

dvFrAddr.Table = dsRolodexXSD.CONTACTS

dvFrAddr.Sort = dsRolodexXSD.CONTACTS.Columns(1).ToString

</code>

 

The dsRolodexXSD.CONTACTS.Columns(1).ToString contains the value "CONTACTNAME". I even try putting the string in manually (just "CONTACTNAME"), but it still doesn't work. I'm not getting an error. The listbox comes up fine with the data, but it is not sorted at all. If the sort method couldn't find the columnname, I would get an error.

 

Why is this not sorting???

Thanks,

 

Bill Yeager (MCP, BCIP)

Microsoft Certified Professional

Brainbench Certified Internet Professional, .Net Programmer, Computer Programmer

YeagerTech Consulting, Inc.

  • *Experts*
Posted

What is dvFrAddr? It "looks" like a DataView, but you're not binding to it...

 

Why not just use the listbox's Sorted property?

 

-Nerseus

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Posted
I had some of the statements reversed. I should have the datasource after the dataview.....

Thanks,

 

Bill Yeager (MCP, BCIP)

Microsoft Certified Professional

Brainbench Certified Internet Professional, .Net Programmer, Computer Programmer

YeagerTech Consulting, Inc.

  • *Experts*
Posted
Did the Listbox's Sorted property do what you want?
"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Posted

You can't specify the sort property for the listbox when a datasource is present for that type of control.

 

I solved it by sorting the datatable and eliminating the view.

Thanks,

 

Bill Yeager (MCP, BCIP)

Microsoft Certified Professional

Brainbench Certified Internet Professional, .Net Programmer, Computer Programmer

YeagerTech Consulting, Inc.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...