Hi Telerik Team,
I use this link and found that this is a very good example of showing something into my product.
http://demos.telerik.com/aspnet-ajax/listbox/examples/functionality/draganddrop/defaultcs.aspx
I open the code and implement the things as discussed in this particular page and found the things proper.
Now the problem is this that I bind the ListBox with the database and try to drag the listbox item from there into the textbox. but now it is giving me that in the function RadListBox_Dropped, e.SourceDragItems.Count become 0 every time.
I am writing my code here.
protected void RadListBox_Dropped(object sender, RadListBoxDroppedEventArgs e)
{
if (txtNoteArea.ClientID == e.HtmlElementID)
{
txtNoteArea.Text = String.Empty;
foreach (RadListBoxItem item in e.SourceDragItems)
{
txtNoteArea.Text += item.Text + ", \n";
}
if (txtNoteArea.Text.Length > 0)
txtNoteArea.Text = txtNoteArea.Text.TrimEnd(new char[] { ',', ' ', '\n' });
}
}
public void BindStandardNotes()
{
DataSet dsMC = new DataSet();
SqlConnection con = new SqlConnection(System.Web.Configuration.WebConfigurationManager.AppSettings["con"]);
SqlDataAdapter adp = new SqlDataAdapter("SPNAME", con);
adp.SelectCommand.CommandType = CommandType.StoredProcedure;
adp.Fill(dsMC);
lstStandardNotes.DataSource = dsMC;
lstStandardNotes.DataValueField = "ID";
lstStandardNotes.DataTextField = "TEXT";
lstStandardNotes.DataBind();
}
<telerik:RadListBox ID="lstStandardNotes" runat="server" Width="90%" Height="200px" SelectionMode="Multiple"
AutoPostBackOnReorder="false" EnableDragAndDrop="true" OnDropped="RadListBox_Dropped" />
<asp:TextBox ID="txtNoteArea" runat="server" Wrap="true" Rows="8" TextMode="MultiLine" Width="90%" Height="200px" ValidationGroup="QAN" />
This code is working fine if I put some static items into the ListBox, but when I bind with the Database, the SourceDragItem count become 0.
Please assist me ASAP.
Regards,
Steve Austin
I use this link and found that this is a very good example of showing something into my product.
http://demos.telerik.com/aspnet-ajax/listbox/examples/functionality/draganddrop/defaultcs.aspx
I open the code and implement the things as discussed in this particular page and found the things proper.
Now the problem is this that I bind the ListBox with the database and try to drag the listbox item from there into the textbox. but now it is giving me that in the function RadListBox_Dropped, e.SourceDragItems.Count become 0 every time.
I am writing my code here.
protected void RadListBox_Dropped(object sender, RadListBoxDroppedEventArgs e)
{
if (txtNoteArea.ClientID == e.HtmlElementID)
{
txtNoteArea.Text = String.Empty;
foreach (RadListBoxItem item in e.SourceDragItems)
{
txtNoteArea.Text += item.Text + ", \n";
}
if (txtNoteArea.Text.Length > 0)
txtNoteArea.Text = txtNoteArea.Text.TrimEnd(new char[] { ',', ' ', '\n' });
}
}
public void BindStandardNotes()
{
DataSet dsMC = new DataSet();
SqlConnection con = new SqlConnection(System.Web.Configuration.WebConfigurationManager.AppSettings["con"]);
SqlDataAdapter adp = new SqlDataAdapter("SPNAME", con);
adp.SelectCommand.CommandType = CommandType.StoredProcedure;
adp.Fill(dsMC);
lstStandardNotes.DataSource = dsMC;
lstStandardNotes.DataValueField = "ID";
lstStandardNotes.DataTextField = "TEXT";
lstStandardNotes.DataBind();
}
<telerik:RadListBox ID="lstStandardNotes" runat="server" Width="90%" Height="200px" SelectionMode="Multiple"
AutoPostBackOnReorder="false" EnableDragAndDrop="true" OnDropped="RadListBox_Dropped" />
<asp:TextBox ID="txtNoteArea" runat="server" Wrap="true" Rows="8" TextMode="MultiLine" Width="90%" Height="200px" ValidationGroup="QAN" />
This code is working fine if I put some static items into the ListBox, but when I bind with the Database, the SourceDragItem count become 0.
Please assist me ASAP.
Regards,
Steve Austin