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
chandu gummadi
NA
67
73.4k
GRIDVIEW SORTING
May 2 2013 2:37 AM
Hi friends iam implementing the gridview sorting in my application but sorting is not done for all rows.
it shows a error like
"can not fine column name empname"
.
iam using bellow code
public void BindGVPasswordChange()
{
try
{
DataTable dt = new DataTable();
Hashtable htnew = new Hashtable();
htnew.Add("PwdId", 0);
dt = _sec.getDataTable("Stp_UM_FillGV_Changepasswords", CommandType.StoredProcedure, htnew);
if (dt.Rows.Count > 0)
{
DataView dv = dt.DefaultView;
if (ViewState["SortDirection"] != null)
{
sortDirection = ViewState["SortDirection"].ToString();
}
if (ViewState["SortExpression"] != null)
{
sortExpression = ViewState["SortExpression"].ToString();
string sort = string.Concat(sortExpression, " ", sortDirection);
dv.Sort = string.Concat(sortExpression, " ", sortDirection);
}
GVChangePwd.DataSource = dv;
GVChangePwd.DataSource = dt;
GVChangePwd.DataBind();
}
GVChangePwd.Visible = true;
}
catch (Exception ex)
{
}
}
protected void GVChangePwd_Sorting(object sender, GridViewSortEventArgs e)
{
if (ViewState["SortDirection"] == null || ViewState["SortExpression"].ToString() != e.SortExpression)
{
ViewState["SortDirection"] = "ASC";
GVChangePwd.PageIndex = 0;
}
else if (ViewState["SortDirection"].ToString() == "ASC")
{
ViewState["SortDirection"] = "DESC";
}
else if (ViewState["SortDirection"].ToString() == "DESC")
{
ViewState["SortDirection"] = "ASC";
}
ViewState["SortExpression"] = e.SortExpression;
BindGVPasswordChange();
}
please help me..
Reply
Answers (
3
)
Asp.Net DateTime Error Message
useing dropdown list validation control