C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




ListBox


Posted Date: 26 Jul 2008      Total Responses: 1

Posted By: jayakumar       Member Level: Gold     Points: 1



i want to view the reports with selected coloumns and the order i selecetd.

its like.,i have one listbox which contains the total available coloumns. if i select the one of the column in the listbox then click a button to add it to a another listbox to build a order of coloumns.

how can i do ?.

am using asp.net 2005 with C# web application





Responses

Author: nirmala    28 Jul 2008Member Level: GoldRating:     Points: 6

haii, try for this code:

.aspx:

<asp:ListBox ID="ListBox1" runat="server" DataSourceID="SqlDataSource1" SelectionMode="single" DataTextField="first_name" DataValueField="first_name">
</asp:ListBox>

<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />

<asp:ListBox ID="ListBox2" runat="server"></asp:ListBox>
<br />
<br />
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:...... %>" SelectCommand="SELECT [first_name], [last_name] FROM [login_inf]" ></asp:SqlDataSource>
.cs:

protected void Button1_Click(object sender, EventArgs e)
{
if (ListBox1.Items.Count != 0)
{
for (int i = 0; i < ListBox1.Items.Count; i++)
{

if (ListBox1.Items[i].Selected == true)
{

ListItem items = ListBox1.SelectedItem;
if (items != null)
{
ListBox1.Items.Remove(items);
ListBox2.ClearSelection();
ListBox2.Items.Add(items);
}
}
}
}



Post Reply
You must Sign In to post a response.
Next : what is server.Flush method and diff b/w
Previous : tell abt Global.asax
Return to Discussion Forum
Post New Message
Category: ASP.NET

Related Messages



dotNet Slackers   BizTalk Adaptors    Web Design


Contact Us    Privacy Policy    Terms Of Use