C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Code Snippets » ASP.NET GridView »

Bulleted list


Posted Date: 26 Sep 2009    Resource Type: Code Snippets    Category: ASP.NET GridView
Author: palaniellappankMember Level: Silver    
Rating: 1 out of 5Points: 5



This code shows example of Bulleted List


<%@ Page Language="C#" %>
<%@ Import Namespace="System.Collections.Generic" %>
<script runat="server">
private List<String> groceries = new List<String>();

void Page_Load()
{
groceries.Add("Milk");
groceries.Add("Steak");
groceries.Add("Fish");
}

protected void Sort_Command(object sender, CommandEventArgs e)
{
if (e.CommandName == "Sort")
{
switch (e.CommandArgument.ToString())
{
case "ASC":
groceries.Sort(SortASC);
break;
case "DESC":
groceries.Sort(SortDESC);
break;
}
}
}

void Page_PreRender()
{
bltGroceries.DataSource = groceries;
bltGroceries.DataBind();
}

int SortASC(string x, string y)
{
return String.Compare(x, y);
}

int SortDESC(string x, string y)
{
return String.Compare(x, y) * -1;
}

</script>
<html>
<head id="Head1" runat="server">
<title>Button Command</title>
</head>
<body>
<form id="form1" runat="server">
<div>

<asp:Button
id="btnSortAsc"
Text="Sort ASC"
CommandName="Sort"
CommandArgument="ASC"
OnCommand="Sort_Command"
Runat="server" />

<asp:Button
id="btnSortDESC"
Text="Sort DESC"
CommandName="Sort"
CommandArgument="DESC"
OnCommand="Sort_Command"
Runat="server" />

<br /><br />

<asp:BulletedList
id="bltGroceries"
Runat="server" />



</div>
</form>
</body>
</html>



Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
Bulleted list  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Confirm delete in gridview control in asp.net
Previous Resource: Generic Code
Return to Discussion Resource Index
Post New Resource
Category: ASP.NET GridView


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use