Hi all!
I am developing a web application in asp.net using c# in three tier architecture, I have to manage appointments in one of the modules.
I have three classes Appointments.aspx.cs , AppointmentsBLL, AppointmetnsDAL.
In gridview i have displayed appointments.like :
AppointmentsBLL appointB = new AppointmentsBLL();
protected void Page_Load(object sender, EventArgs e)
{
gvAppointmetns.DataSource = appointB.showAppointments();
gvAppointmetns.DataBind();
}
BLL code is this:
public DataTable showAppointments()
{
DataTable dtAppoint;
AppointmentsTableAdapter appointAdapt = new AppointmentsTableAdapter();
dtAppoint = appointAdapt.GetAppointmentsData()
return dtAppoint;
}
I am able to insert records easily but the problem is that I want to update and delete those records as well. for which I have used template field "action" and image buttons "edit" and "delete" are bounded in that template field.Now what I want is: when I click edit button the record of that specific row is selected and appear in the text boxes below, I have tried many options like selected row , datakeynames etc but nothing happens when I click on edit button.I have been successfull in edting and deleting records using sqldatasource and gridview methods but that is not working in three tier, As I am new to asp.net so could anyone kindly guide me. may be I am missing some thing.
method for edit button click is:
protected void ImgBtnEdit_Click(object sender, ImageClickEventArgs e)
{
tb_AppointDate.Text = gvAppointmetns.SelectedRow.Cells[3].Text.ToString();
tb_GName.Text = gvAppointmetns.SelectedRow.Cells[4].Text.ToString();
tb_GDesignation.Text = gvAppointmetns.SelectedRow.Cells[5].Text.ToString();
}
during debugging selected row shows null value inserted.
Thanks in advance.