Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post May 17, 2012 05:21 AM by Ravi Kumar Kurasala
Member
44 Points
118 Posts
May 17, 2012 03:14 AM|LINK
Hi
I using rad:Grid in my asp.net application... Here i m using following columns
Name
Roll
Edit Attendance -- only activate in when click Action ( Item Command)
Action -- Provide one Edit Link Button
Remarks
when I m click edit, in edit Attendance column I m display one dropdown list also added the Item Present and Absent.
after choose the value from dropdown list.. i wanna to update the record.. So i need value of Name Column of corressponding row.
How do i get the column value??
My Coding:
protected void gvAttendance_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e) { updateAttendanceObj.SessionHeaderValue = new UpdateAttendanceList.SessionHeader(); updateAttendanceObj.SessionHeaderValue.sessionId = sessionId; if (e.CommandName == "EditMode") { // gvAttendance.Columns[3].Visible = true; ((Panel)e.Item.FindControl("panelEditMode")).Visible = true; } if (e.CommandName == "UpdateAttendance") { string attendanceText = ((DropDownList)e.Item.FindControl("ddlAttendance")).SelectedItem.Text; ((Panel)e.Item.FindControl("panelEditMode")).Visible = false; /***********************************************************************/
/** Here only i need the Name Column value **//
/************************************************************************/
this.dtAttendanceBind(); //updateAttendanceObj.UpdateAttendanceFromClassname(sClassName, sClassName, attendanceText); } if (e.CommandName == "Cancel") { ((Panel)e.Item.FindControl("panelEditMode")).Visible = false; // gvAttendance.Columns[3].Visible = false; this.dtAttendanceBind(); } } protected void gvAttendance_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) { if (e.Item.ItemType == Telerik.Web.UI.GridItemType.Item || e.Item.ItemType == Telerik.Web.UI.GridItemType.AlternatingItem) { //((LinkButton)e.Item.FindControl("lnkApply")).Text = Resources.Job_BookmarkJobs.lbApply; ((LinkButton)e.Item.FindControl("lnkEdit")).Text = "Edit"; ((LinkButton)e.Item.FindControl("lnkUpdate")).Text = "Update"; ((LinkButton)e.Item.FindControl("lnkCancel")).Text = "Cancel";
727 Points
155 Posts
May 17, 2012 05:21 AM|LINK
int index = ((GridViewRow)((Control)sender).NamingContainer).RowIndex;
string name =Convert.ToString(gvAttendance.Rows[index].Cells[0].Text); //cells[index of name column]
riyaju
Member
44 Points
118 Posts
How to get grid row values from selecting row???
May 17, 2012 03:14 AM|LINK
Hi
I using rad:Grid in my asp.net application... Here i m using following columns
Name
Roll
Edit Attendance -- only activate in when click Action ( Item Command)
Action -- Provide one Edit Link Button
Remarks
when I m click edit, in edit Attendance column I m display one dropdown list also added the Item Present and Absent.
after choose the value from dropdown list.. i wanna to update the record.. So i need value of Name Column of corressponding row.
How do i get the column value??
My Coding:
protected void gvAttendance_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e) { updateAttendanceObj.SessionHeaderValue = new UpdateAttendanceList.SessionHeader(); updateAttendanceObj.SessionHeaderValue.sessionId = sessionId; if (e.CommandName == "EditMode") { // gvAttendance.Columns[3].Visible = true; ((Panel)e.Item.FindControl("panelEditMode")).Visible = true; } if (e.CommandName == "UpdateAttendance") { string attendanceText = ((DropDownList)e.Item.FindControl("ddlAttendance")).SelectedItem.Text; ((Panel)e.Item.FindControl("panelEditMode")).Visible = false; /***********************************************************************/this.dtAttendanceBind(); //updateAttendanceObj.UpdateAttendanceFromClassname(sClassName, sClassName, attendanceText); } if (e.CommandName == "Cancel") { ((Panel)e.Item.FindControl("panelEditMode")).Visible = false; // gvAttendance.Columns[3].Visible = false; this.dtAttendanceBind(); } } protected void gvAttendance_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) { if (e.Item.ItemType == Telerik.Web.UI.GridItemType.Item || e.Item.ItemType == Telerik.Web.UI.GridItemType.AlternatingItem) { //((LinkButton)e.Item.FindControl("lnkApply")).Text = Resources.Job_BookmarkJobs.lbApply; ((LinkButton)e.Item.FindControl("lnkEdit")).Text = "Edit"; ((LinkButton)e.Item.FindControl("lnkUpdate")).Text = "Update"; ((LinkButton)e.Item.FindControl("lnkCancel")).Text = "Cancel";Ravi Kumar K...
Member
727 Points
155 Posts
Re: How to get grid row values from selecting row???
May 17, 2012 05:21 AM|LINK
int index = ((GridViewRow)((Control)sender).NamingContainer).RowIndex;
string name =Convert.ToString(gvAttendance.Rows[index].Cells[0].Text); //cells[index of name column]