TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Narayanan Ramachandran
NA
132
0
how to sort serial no inside gridview
Jun 8 2013 3:41 AM
Hi
I am having datagridview in c#
I populated data inside datagridview.
I created Serial No inside datagridview along with other columns.
If i click serial no head,the serial no is sorted.
If i do sorting in other columns,the serial no is also sorted.
How to avoid sorting serial no, if I click other column headers.
I have given the code below
dsstock = new DataSet();
dsstock = fetchDataSetValues(statement);
// grdStock.Rows.Clear();
if (dsstock.Tables[0].Rows.Count > 0)
{
grdStock.Columns.Add("Sl. No.", "Sl. No.");
grdStock.Columns[0].Width = 80;
grdStock.Columns.Add("ItemID", "Item ID");
grdStock.Columns[1].Width =300;
grdStock.Columns.Add("ItemName", "Item Name");
grdStock.Columns[2].Width = 600;
grdStock.Columns.Add("ItemQuantity", "Item Quantity");
grdStock.Columns[3].Width = 150;
int row = dsstock.Tables[0].Rows.Count - 1;
for (int r = 0; r <= row; r++)
{
grdStock.Rows.Add();
grdStock.Rows[r].Cells[0].Value = r + 1;
grdStock.Rows[r].Cells[1].Value = dsstock.Tables[0].Rows[r].ItemArray[0];
grdStock.Rows[r].Cells[2].Value = dsstock.Tables[0].Rows[r].ItemArray[1];
grdStock.Rows[r].Cells[3].Value = dsstock.Tables[0].Rows[r].ItemArray[2];
}
}
Thanks
Chandran
Reply
Answers (
1
)
when i entered house no in first textbox ..display textbox2.
User updating controls and compiling