Blog coding and discussion of coding about JavaScript, PHP, CGI, general web building etc.

Tuesday, August 2, 2016

The GridView fired event RowEditing which wasn't handled

The GridView fired event RowEditing which wasn't handled


using System;  using System.Collections.Generic;  using System.Configuration;  using System.Data;  using System.Data.SqlClient;  using System.IO;  using System.Linq;  using System.Web;  using System.Web.UI;  using System.Web.UI.WebControls;    namespace AppManagementConsole  {      public partial class _Default : Page      {          string BuildUploadPath = ConfigurationManager.AppSettings["DirectoryPath"] + "Files/";          string ReleaseNotesUpPath = ConfigurationManager.AppSettings["DirectoryPath"] + "ReleaseNotes/";        protected void Page_Load(object sender, EventArgs e)      {          cpBuildDate.SelectedDate = DateTime.Now;          getBuildData();      }        public void getBuildData()      {          //Select Build List          SqlCommand selectCommand = new SqlCommand("Select * from tblBuildList");            try          {              //Connect to DB              using (SqlConnection conRDB = new SqlConnection(ConfigurationManager.ConnectionStrings["conRDB"].ConnectionString))              {                  SqlDataAdapter selectAdapater = new SqlDataAdapter(selectCommand.CommandText, conRDB);                    DataSet dsBuilds = new DataSet();                  selectAdapater.Fill(dsBuilds);                    //Populate Webpage GV                  gvDataBind(dsBuilds);              }          }            catch (Exception ex)          {          }      }          public void gvDataBind(DataSet dsBuilds)      {          gvBuildList.Dispose();          gvBuildList.DataSource = dsBuilds;          gvBuildList.DataBind();      }        protected void gvBuildList_RowEditing(object sender, GridViewEditEventArgs e)      {          gvBuildList.PageIndex = e.NewEditIndex;          //Bind data to the GridView control.          getBuildData();      }        protected void btnSubmit_Click(object sender, EventArgs e)      {          //Upload Files          UploadFiles();            //Update SQL Table          AddBuildInfo(txtProduct.Text, txtPlatform.Text, cpBuildDate.SelectedDate, txtPublisher.Text, txtVersion.Text, BuildUploadPath,FileUpBuild.FileName, ReleaseNotesUpPath, FileUpRelease.FileName, txtComments.Text);      }        private void UploadFiles()      {          #region Build          string tempfileDir = @"C:\Publish\TempFileStorage\";          if (FileUpBuild.HasFile)          {              try              {                  if (!Directory.Exists(tempfileDir))                  {                      Directory.CreateDirectory(tempfileDir);                  }                  FileUpBuild.SaveAs(@"C:\Publish\TempFileStorage\" + FileUpBuild.FileName);                  FTP.FtpUpload(BuildUploadPath, FileUpBuild.FileName, tempfileDir + FileUpBuild.FileName);                  //FileUpBuild.SaveAs();                  //FileUpBuild.FileContent();              }              catch (Exception ex)              {              }              finally              {                  File.Delete(@"C:\Publish\TempFileStorage\" + FileUpBuild.FileName);              }          }          

0 comments:

Post a Comment

Popular Posts

Powered by Blogger.