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
Pankaj Singh
NA
97
0
Gridview issue
Jul 20 2012 3:01 AM
Hi,
I am binding data from SQL table in gridview. I want to change one column(command field) value not header at runtime. I am using following code but it change header also.
HTML code:
<Columns>
<asp:BoundField DataField="id" HeaderText="ID" />
<asp:ImageField DataImageUrlField="imgpath" HeaderText="Photo">
<ControlStyle Height="50px" Width="50px" />
</asp:ImageField>
<asp:BoundField DataField="name" HeaderText="Name" />
<asp:BoundField DataField="Country" HeaderText="Country" />
<asp:CommandField HeaderText="Status" SelectText="Apply"
ShowSelectButton="True">
<ControlStyle ForeColor="Blue" />
</asp:CommandField>
</Columns>
server side code:
protected void grddetails_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow || e.Row.RowType == DataControlRowType.Header)
{
int len = ds.Tables[0].Rows.Count;
for (int i = 0; i < len; i++)
{
int id = Convert.ToInt32(ds.Tables[0].Rows[i].ItemArray[0]);
// check ID exists or not
com = new SqlCommand("SELECT 1 FROM Table WHERE id=" + id + "", con);
con.Open();
drd = com.ExecuteReader();
if (drd.Read())
e.Row.Cells[4].Text="Apply";
else
e.Row.Cells[4].Text="not Apply";
con.Close();
}
}
Please help me
Thanks in advance
Reply
Answers (
6
)
i have a kml file and have to display tags of that kml file in asp.net using c# code behind. please help me.
Trying to export html to pdf