Hi,
Here is the code:
protected void gvProjectDetails_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
{
string proj_id = gvProjectDetails.SelectedRow.Cells[1].Text;
conobj.connect();
conobj.CMD.CommandText = "select * from ProjectDetailsMaster where ProjectID='"+proj_id+"'";
conobj.DTR = conobj.CMD.ExecuteReader(CommandBehavior.CloseConnection);
while (conobj.DTR.Read())
{
txtprojname.Text=conobj.DTR["ProjectName"].ToString();
txtprojdescription.Text = conobj.DTR["Description"].ToString();
txtstartdate.Text = conobj.DTR["StartDate"].ToString();
txtenddate.Text = conobj.DTR["EndDate"].ToString();
txtduration.Text = conobj.DTR["Duration"].ToString();
}
conobj.DTR.Close();
}
=================================================
Getting an error: Object reference not set to an object at the 1st line of code
Loading
Nethra R SPosted Jun 28, 2011, 5:39 AM
Morcos AdelPosted Jun 28, 2011, 5:37 AM
i think you should use the event
GridView1_SelectedIndexChanged(object sender, EventArgs e)
not _SelectedIndexChanging
hope this helps :)