Go Back   CodingForums.com > :: Server side development > ASP.NET

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-27-2013, 03:08 AM   PM User | #1
DanInMa
Senior Coder

 
DanInMa's Avatar
 
Join Date: Nov 2010
Location: Salem,Ma
Posts: 1,307
Thanks: 12
Thanked 204 Times in 204 Posts
DanInMa is on a distinguished road
Listview reordering position in list oninsert and onchange

basic idea first. I have a table with several fields, the 2 important ones being "ID" and "Postion" . There will only be 4 entries in the table. ( they are links that will go on parts of specific pages).
The position is 1,2,3 or 4.

Things I need to figure out

- How do I limit the maximum number of records to 4? ( more of an mssql question I suppose)
- Ondatabind how do I hide the insert row if there are a total of 4 items in the table. ( to prevent the user from attempting to do so)
- when the user changes the position field of a row to a different number ( using a dropdown list), how do I then reorder the other rows in the table ?


- on the front end the Position field determines the position the links go into an unordered list for display ( jsut so you understand what Im trying to do)

I assume I should somehow indicate that the position row in the table should have distinct/unique values? I will take example but Id prefer tutorials. If you can help with even one piece of this Im glad for the assistance.
In regards to reordering the list, I'm sure it's a common enough task but I don't know what the terminology for the process would be so I didnt have much success with google.

- Im using c# on 4.0 framework
__________________
- Firebug is a web developers best friend! - Learn it, Love it, use it!
- Validate your code! - JQ/JS troubleshooting
- Using jQuery with Other Libraries - Jslint for Jquery/other JS library users
DanInMa is offline   Reply With Quote
Old 01-28-2013, 04:42 AM   PM User | #2
DanInMa
Senior Coder

 
DanInMa's Avatar
 
Join Date: Nov 2010
Location: Salem,Ma
Posts: 1,307
Thanks: 12
Thanked 204 Times in 204 Posts
DanInMa is on a distinguished road
- Ondatabind how do I hide the insert row if there are a total of 4 items in the table. ( to prevent the user from attempting to do so)

well i figured out how to do this part so far.
__________________
- Firebug is a web developers best friend! - Learn it, Love it, use it!
- Validate your code! - JQ/JS troubleshooting
- Using jQuery with Other Libraries - Jslint for Jquery/other JS library users
DanInMa is offline   Reply With Quote
Old 01-28-2013, 12:57 PM   PM User | #3
alykins
Senior Coder

 
alykins's Avatar
 
Join Date: Apr 2011
Posts: 1,608
Thanks: 37
Thanked 183 Times in 182 Posts
alykins will become famous soon enough
are you creating a datatable first and then binding the datatable to the gridview? you don't need to databind the gridview to the database. You can populate a datatable and then manipulate it any way you want, then bind it to the gridview... see my reply in this thread... although I answered the OP wrong, the logic is correct- i just didn't understand the OP question correctly :P

Does that help?
__________________

I code C hash-tag .Net
Reference: W3C W3CWiki .Net Lib
Validate: html CSS
Debug: Chrome FireFox IE
alykins is offline   Reply With Quote
Old 01-29-2013, 02:02 AM   PM User | #4
DanInMa
Senior Coder

 
DanInMa's Avatar
 
Join Date: Nov 2010
Location: Salem,Ma
Posts: 1,307
Thanks: 12
Thanked 204 Times in 204 Posts
DanInMa is on a distinguished road
nope the table is already created. each row has a column "position" , position should be limited to 1-4. lets say I change record 1 from position value of 1 to a value of 3, then i want to change the position value in record 2 to 1, record 3 to position 2, record 1 to position 3 and record 4 to position 4.

I have limited the listview to show a maxaimum of 4 items and if there are 4 items the insert option no longer shows, so they cant go over 4.

if you need to see my table setup or anything at all sut ask, im not sure what would be most helpful.
__________________
- Firebug is a web developers best friend! - Learn it, Love it, use it!
- Validate your code! - JQ/JS troubleshooting
- Using jQuery with Other Libraries - Jslint for Jquery/other JS library users
DanInMa is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:28 AM.


Advertisement
Log in to turn off these ads.