Find control in gridview_rowcommand event

 protected void dgAvailability_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                if (e.CommandName == "Save")
                {
                    GridViewRow row = (GridViewRow)(((Button)e.CommandSource).NamingContainer);
                    DropDownList ddl = (DropDownList)row.Cells[3].FindControl("ddlResponse");
                    BFixturePlayer obj = new BFixturePlayer();
                    obj.Key = int.Parse(dgAvailability.DataKeys[row.RowIndex].Value.ToString());
                    obj.Response = int.Parse(ddl.SelectedValue);
                    obj.SaveResponse();
                    LoadAvailability();
                }
               
            }
            catch (Exception exp)
            {
                divError.InnerHtml = exp.Message;
            }
        }

Comments

Popular posts from this blog

what is Event Cache table in sharepoint

CAML Query syntax and options in SharePoint

Change anchor link url in sharepoint calender