Click here to Skip to main content
14,875,792 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i have an database table which have two columns "person name" and "status". "status" have value either VERIFIED or NOT VERIFIED. i want to bind repeater control to show verified persons first than repeat binding for not verified persons.
Updated 20-Aug-13 4:48am
Please post some code and let us know where exactly you are facing.

1 solution

Design your repeater control

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Person.aspx.cs" Inherits="RepeaterExample.Person" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<html xmlns="">
<head runat="server">
    <form id="form1" runat="server">
    <asp:Repeater ID="rptPerson" runat="server">
                    <th>Person Name</th>
            <td><%# Eval("PersonName") %></td>
             <td><%# Eval("Status") %></td>

Create your method for bind repeater using view like

using System;
using System.Data;
using System.Data.SqlClient;

namespace RepeaterExample
    public partial class Person : System.Web.UI.Page
        protected void Page_Load(object sender, EventArgs e)
            if (!Page.IsPostBack)
        private void RepeaterBind()
            string connectionString = "Data Source=sandeepss-PC;Initial Catalog=CodeFirst;User ID=sa; Password=123456";
            SqlConnection con = new SqlConnection(connectionString);
            SqlCommand cmd = new SqlCommand("Select * FROM Person", con);
            IDataReader dr = cmd.ExecuteReader();

            DataTable dt = new DataTable();
            DataView dv = dt.DefaultView;
            dv.Sort = "Status DESC";
            rptPerson.DataSource = dv;
Abhishek Ginani 20-Aug-13 14:36pm
Thank you very much sandeep singh... :-)
Sandeep Singh Shekhawat 21-Aug-13 2:04am
Welcome dear Abhishek!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900