protected void gvPolls_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            int ddl = ddlSearch.SelectedValue.Length;
            int txt = txtSearch.Text.Length;

            if (e.CommandName == "InsertRow")
            {
                try
                {
                    DataAccessLayer DAL             = new DataAccessLayer();
                    string          PollType        = ((TextBox)gvPolls.FooterRow.FindControl("txtPollTypeFooter")).Text;
                    string          PollName        = ((TextBox)gvPolls.FooterRow.FindControl("txtPollNameFooter")).Text;
                    string          PollQuestion    = ((TextBox)gvPolls.FooterRow.FindControl("txtPollQuesFooter")).Text;
                    string          PollDescription = ((TextBox)gvPolls.FooterRow.FindControl("txtPollDescFooter")).Text;
                    string          PollRole        = ((DropDownList)gvPolls.FooterRow.FindControl("ddlPollRoleFooter")).SelectedValue;
                    string          PollStatus      = ((DropDownList)gvPolls.FooterRow.FindControl("ddlInsertStatusFooter")).SelectedValue;
                    DAL.InsertPoll(PollType, PollName, PollQuestion, PollDescription, PollRole, PollStatus);
                    GridBind();
                    lblErrorMessage.Visible   = true;
                    lblErrorMessage.Text      = "New Poll title <b>" + PollName + "</b> has been created with Type as <b>" + PollType + ")</b>";
                    lblErrorMessage.ForeColor = System.Drawing.Color.Green;
                }
                catch (Exception ex)
                {
                    lblErrorMessage.Visible   = true;
                    lblErrorMessage.Text      = "Insert Exception: " + ex.Message;
                    lblErrorMessage.ForeColor = System.Drawing.Color.Red;
                }
            }

            else if (e.CommandName == "EditRow")
            {
                try
                {
                    lblErrorMessage.Visible = false;
                    lblException.Visible    = false;
                    if (ddl != 0 && txt != 0)
                    {
                        int rowIndex = ((GridViewRow)((ImageButton)e.CommandSource).NamingContainer).RowIndex;
                        gvPolls.EditIndex = rowIndex;
                        GridSearch();
                    }
                    else
                    {
                        int rowIndex = ((GridViewRow)((ImageButton)e.CommandSource).NamingContainer).RowIndex;
                        gvPolls.EditIndex = rowIndex;
                        GridBind();
                    }
                }
                catch (Exception ex)
                {
                    lblErrorMessage.Visible   = true;
                    lblErrorMessage.Text      = " Edit Exception: " + ex.Message;
                    lblErrorMessage.ForeColor = System.Drawing.Color.Red;
                }
            }
            else if (e.CommandName == "DeleteRow")
            {
                try
                {
                    lblException.Visible    = false;
                    lblErrorMessage.Visible = false;
                    if (ddl != 0 && txt != 0)
                    {
                        DataAccessLayer.DeletePoll(Convert.ToInt32(e.CommandArgument));
                        GridSearch();
                    }
                    else
                    {
                        DataAccessLayer.DeletePoll(Convert.ToInt32(e.CommandArgument));
                        GridBind();
                    }
                }
                catch (Exception ex)
                {
                    lblErrorMessage.Visible   = true;
                    lblErrorMessage.Text      = "Delete Exception: " + ex.Message;
                    lblErrorMessage.ForeColor = System.Drawing.Color.Red;
                }
            }
            else if (e.CommandName == "CancelUpdate")
            {
                try
                {
                    lblException.Visible    = false;
                    lblErrorMessage.Visible = false;
                    if (ddl != 0 && txt != 0)
                    {
                        gvPolls.EditIndex = -1;
                        GridSearch();
                    }
                    else
                    {
                        gvPolls.EditIndex = -1;
                        GridBind();
                    }
                }
                catch (Exception ex)
                {
                    lblException.Visible   = true;
                    lblException.Text      = "Cancel Exception: " + ex.Message;
                    lblException.ForeColor = System.Drawing.Color.Red;
                }
            }
            else if (e.CommandName == "UpdateRow")
            {
                try
                {
                    lblException.Visible    = false;
                    lblErrorMessage.Visible = false;
                    DataAccessLayer DAL             = new DataAccessLayer();
                    int             rowIndex        = ((GridViewRow)((ImageButton)e.CommandSource).NamingContainer).RowIndex;
                    int             PollID          = Convert.ToInt32(e.CommandArgument);
                    string          PollType        = ((TextBox)gvPolls.Rows[rowIndex].FindControl("txtPollType")).Text;
                    string          PollName        = ((TextBox)gvPolls.Rows[rowIndex].FindControl("txtPollName")).Text;
                    string          PollQuestion    = ((TextBox)gvPolls.Rows[rowIndex].FindControl("txtPollQues")).Text;
                    string          PollDescription = ((TextBox)gvPolls.Rows[rowIndex].FindControl("txtPollDesc")).Text;
                    string          PollStatus      = ((DropDownList)gvPolls.Rows[rowIndex].FindControl("ddlEditStatus")).SelectedValue;
                    string          PollRole        = ((DropDownList)gvPolls.Rows[rowIndex].FindControl("ddlEditPollRole")).SelectedValue;
                    lblErrorMessage.Visible   = true;
                    lblErrorMessage.Text      = "Poll-Name <b>" + PollName + "</b> and Poll-Type <b>" + PollType + "</b> has been updated";
                    lblErrorMessage.ForeColor = System.Drawing.Color.Green;
                    DAL.UpdatePoll(PollID, PollType, PollName, PollQuestion, PollDescription, PollRole, PollStatus);
                    lblSearchError.Visible = false;
                    if (ddl != 0 && txt != 0)
                    {
                        gvPolls.EditIndex = -1;
                        GridSearch();
                    }
                    else
                    {
                        gvPolls.EditIndex = -1;
                        GridBind();
                    }
                }
                catch (Exception ex)
                {
                    lblErrorMessage.Visible   = true;
                    lblErrorMessage.Text      = "Update Exception: " + ex.Message;
                    lblErrorMessage.ForeColor = System.Drawing.Color.Red;
                }
            }
        }