select command on the gridview

Joined
Aug 9, 2008
Messages
1
Reaction score
0
Hello
I have a gridview that contain a template field I fill this template filed with this code :
Code:
   protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        
          if ((e.Row.RowType == DataControlRowType.DataRow ) & (e.Row.RowType!=DataControlRowType.Footer))
        { 
            DateTime datefromdb=Convert.ToDateTime(DataBinder.Eval(e.Row.DataItem,"date1"));
            
            System.Globalization.PersianCalendar PersianCalendar = new PersianCalendar();
            int daytoshamsi = PersianCalendar.GetDayOfMonth(datefromdb);
            int monthtoshamsi = PersianCalendar.GetMonth(datefromdb);
            int yeartoyear = PersianCalendar.GetYear(datefromdb);

            e.Row.Cells[5].Text = daytoshamsi+ "/" + monthtoshamsi + "/"+ yeartoyear;
        }

    }


I enable the selection on gridview and run it
when the page load template filed fill correctly.but when I click the select command on the gridview the content of template field disappear.why?
can anyone help me?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top