geting error Input string was not in a correct format.
at the time of compile
error show here in this line
int task_id = Convert.ToInt32(e.Row.Cells[1].Text);
<asp:GridView ID="post" runat="server" AutoGenerateColumns="false" DataKeyNames="task_id"
OnRowDataBound="post_RowDataBound" GridLines="None" BorderStyle="Solid" BorderWidth="1px" BorderColor="#df5015">
<Columns>
<asp:BoundField ItemStyle-Width="150px" DataField="task_id" HeaderText="id" />
<asp:BoundField ItemStyle-Width="150px" DataField="message" HeaderText="message" />
<asp:BoundField ItemStyle-Width="150px" DataField="post_name" HeaderText="post name" />
<asp:BoundField ItemStyle-Width="150px" DataField="curnt_date" HeaderText="date" />
<asp:BoundField ItemStyle-Width="150px" DataField="asign_name" HeaderText="asign name" />
<asp:TemplateField>
<ItemTemplate>
<div id='div<%# Eval("task_id") %>' style="display: none; position: relative; left: 15px; overflow: auto">
<asp:GridView ID="comment" runat="server" AutoGenerateColumns="false">
<Columns>
<asp:BoundField ItemStyle-Width="150px" DataField="comment" />
<asp:BoundField ItemStyle-Width="150px" DataField="rply_name" />
<asp:BoundField ItemStyle-Width="150px" DataField="rpl_date" />
</Columns>
</asp:GridView>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Bindgridview();
}
}
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ApplicationServices"].ConnectionString);
protected void Bindgridview()
{
con.Open();
SqlCommand cmd = new SqlCommand("select task_id,message,post_name,curnt_date,asign_name from task", con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
con.Close();
post.DataSource = ds;
post.DataBind();
}
protected void post_RowDataBound(object sender, GridViewRowEventArgs e)
{
if(e.Row.RowType == DataControlRowType.DataRow)
{
con.Open();
GridView gv = (GridView)e.Row.FindControl("comment");
int task_id = Convert.ToInt32(e.Row.Cells[1].Text);
SqlCommand cmd = new SqlCommand("select * from rply where task_id= " + task_id, con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
con.Close();
gv.DataSource = ds;
gv.DataBind();
}
}