Editing problem in Datagrid
-
Hi, I've a datagrid connected to one table from postgres database. I'm using ODBC. Also, table has only 3 columns, out of which I'm using only 2 columns, and I'mve added these columns to datagrid manually. Now, when I try to edit ot even try to add new row after postback it doesnt seem to work! The form doesnt do anything. There is another form where I'm creating and populating (basically handling everything at runtime) and there the same piece of code is working just fine! Here is the code of the form that is not working... <--CODE-ASPX-START--> Make Changes Add New <--CODE-ASPX-END--> <--CODE-ASPX.CS-START--> private void Page_Load(object sender, System.EventArgs e) { string connectionStr = "DRIVER={PostgreSQL}; SERVER=localhost;UID=xxx;PASSWORD=xxx;Trusted_connection=false;DATABASE=marketing;"; string str = "select pk_url,url_name,url_comments FROM urls;"; connection = new OdbcConnection(connectionStr); connection.Open(); selectCommand = new OdbcCommand(str,connection); adapter = new OdbcDataAdapter(selectCommand); ds = new DataSet(); adapter.Fill(ds,"urls"); DataGrid1.DataSource = ds; DataGrid1.DataMember = "urls"; DataGrid1.DataBind(); connection.Close(); } #region Web Form Designer generated code override protected void OnInit(EventArgs e) { // // CODEGEN: This call is required by the ASP.NET Web Form Designer. // InitializeComponent(); base.OnInit(e); } /// /// Required method for Designer support - do not modify
-
Hi, I've a datagrid connected to one table from postgres database. I'm using ODBC. Also, table has only 3 columns, out of which I'm using only 2 columns, and I'mve added these columns to datagrid manually. Now, when I try to edit ot even try to add new row after postback it doesnt seem to work! The form doesnt do anything. There is another form where I'm creating and populating (basically handling everything at runtime) and there the same piece of code is working just fine! Here is the code of the form that is not working... <--CODE-ASPX-START--> Make Changes Add New <--CODE-ASPX-END--> <--CODE-ASPX.CS-START--> private void Page_Load(object sender, System.EventArgs e) { string connectionStr = "DRIVER={PostgreSQL}; SERVER=localhost;UID=xxx;PASSWORD=xxx;Trusted_connection=false;DATABASE=marketing;"; string str = "select pk_url,url_name,url_comments FROM urls;"; connection = new OdbcConnection(connectionStr); connection.Open(); selectCommand = new OdbcCommand(str,connection); adapter = new OdbcDataAdapter(selectCommand); ds = new DataSet(); adapter.Fill(ds,"urls"); DataGrid1.DataSource = ds; DataGrid1.DataMember = "urls"; DataGrid1.DataBind(); connection.Close(); } #region Web Form Designer generated code override protected void OnInit(EventArgs e) { // // CODEGEN: This call is required by the ASP.NET Web Form Designer. // InitializeComponent(); base.OnInit(e); } /// /// Required method for Designer support - do not modify