Forum  Core :: SDK (Vi...  Using the Visua...  Listview - Drag Drop not working. Help needed...
Previous Previous
 
Next Next
New Post 3/1/2009 9:31 AM
Unresolved
  samsuree
38 posts
No Ranking


Listview - Drag Drop not working. Help needed... 

Hi ,

  I have a scenario in which i have 2 listview s displayed in a form. And one listview is populated with the data. I need to drag and drop (multiple items) items from one listview to the other. And the item should be removed from the one in which it was dragged. It will be great if some one could help me out in sorting the issue.

I have added the code below:

 

private void frmDragDropTest_Load(object sender, EventArgs e)

{

TestEntities testctxt = new TestEntities();

Test t = new Test();

ObjectQuery<Test> tquery = testctxt.Test;

// this.listView1.DataMember = "TestDesc";

listView1.DataSource = tquery.Execute(MergeOption.AppendOnly);

listView1.DragTargets = new Gizmox.WebGUI.Forms.Component[] { listView2 };

// listView1.AllowDrop = true;

listView2.DragDrop += new DragEventHandler(listView1_DragDrop);

listView1.DragDrop += new DragEventHandler(listView2_DragDrop);

}

private void listView1_DragDrop(object sender, DragEventArgs e)

{

if (e is DragDropEventArgs)

{

DragDropEventArgs objDragDropEventArgs = e as DragDropEventArgs;

if ((objDragDropEventArgs.Source as ListView).SelectedItem != null )

{

if ((objDragDropEventArgs.Source is ListView) && (objDragDropEventArgs.Target is ListView))

MessageBox.Show(string.Format("Product {0} dropped on Order {1}",

listView1.SelectedItem.SubItems[0].ToString(),

((ListViewItem)objDragDropEventArgs.TargetMember).SubItems[0].ToString()));

//listView2.AllowDrop = true;

//listView2.Items.Add(listView1.SelectedItem);

 

}

}

}

private void listView2_DragDrop(object sender, DragEventArgs e)

{

if (e is DragDropEventArgs)

{

DragDropEventArgs objDragDropEventArgs = e as DragDropEventArgs;

if ((objDragDropEventArgs.Source as ListView).SelectedItem != null)

{

if ((objDragDropEventArgs.Source is ListView) && (objDragDropEventArgs.Target is ListView))

MessageBox.Show(string.Format("Product {0} dropped on Order {1}",

listView1.SelectedItem.SubItems[0].ToString(),

((ListViewItem)objDragDropEventArgs.TargetMember).SubItems[0].ToString()));

// //listView2.AllowDrop = true;

//listView2.Items.Add(listView1.SelectedItem);

}

}

}

 

Regards,

Suresh A


Regards, Suresh A Winwire Technologies www.winwire.com
 
New Post 3/4/2009 3:19 PM
  palli
11824 posts
1st Level Poster




Re: Listview - Drag Drop not working. Help needed... 

Hi,

Dropping onto a ListView you can find an example of in the Catalog sample app. You can view it online here and take a look at Behaviours\Misc Behaviours\Drag and Drop.

The source code for the Catalog app you can download at the download page here.

Hope this helps to get you started.

Palli

 


Páll Björnsson - Visual WebGui support team - Email: support@visualwebgui.com
 
New Post 4/1/2009 4:26 AM
  samsuree
38 posts
No Ranking


Re: Listview - Drag Drop not working. Help needed... 

Hi Palli,

   Thanks for your response. I am creating the listviews in runtime and not at the design time. In the catalog the listview is created during the design time and i need a solution for the same. Also i am not in a position to provide you the sample application. Kindly provide me a solution for this.

Suresh A



Regards, Suresh A Winwire Technologies www.winwire.com
 
New Post 4/1/2009 2:52 PM
  palli
11824 posts
1st Level Poster




Re: Listview - Drag Drop not working. Help needed... 

Hi Suresh A,

I need you to explain in more detail what specific information you need. I did refer you to the Catalog sample application, which is our most valuable source on how to use Visual WebGUI controls, as well as the Resources part on our site here.

About how to create a ListView contron in designer, you can take a look at this video here.

Palli

 


Páll Björnsson - Visual WebGui support team - Email: support@visualwebgui.com
 
New Post 4/6/2009 11:50 PM
  samsuree
38 posts
No Ranking


Re: Listview - Drag Drop not working. Help needed... 

Hi Palli,

 I am creating the listview during runtime and not using the designer. If you could give me a solution for the same will be of great help for me.

Regards,

Suresh A

Winwire Technologies


Regards, Suresh A Winwire Technologies www.winwire.com
 
Previous Previous
 
Next Next
  Forum  Core :: SDK (Vi...  Using the Visua...  Listview - Drag Drop not working. Help needed...
CompanionKit Bottom
.NET Web, Cloud and Mobile application delivery platform | Sitemap | Terms of Use | Privacy Statement | Copyright © 2005-2011 Visual WebGui®       Visual WebGui weblog on ASP.NET Visual WebGui Group on LinkedIn Visual WebGui updates on Twitter Visual WebGui Page on Facebook Visual WebGui YouTube Channel Visual WebGui Platform News RSS