Hi,
In the below code its not showing any error but its not updating: -
using System;
-
using System.Collections.Generic;
-
using System.Linq;
-
using System.Web;
-
using System.Web.UI;
-
using System.Web.UI.WebControls;
-
using System.Data.SqlClient;
-
using System.Data;
-
-
public partial class VendorDetails : System.Web.UI.Page
-
{
-
protected void Page_Load(object sender, EventArgs e)
-
{
-
gridViewDataBind();
-
}
-
protected void LinkButton1_Click(object sender, EventArgs e)
-
{
-
Response.Redirect("AddDetails.aspx");
-
}
-
//protected void gvVendor_RowCancellingEdit(object sender, GridViewCancelEditEventArgs e)
-
//{
-
// gvVendor.EditIndex = -1;
-
//}
-
protected void gridViewDataBind()
-
{
-
string strcon = System.Configuration.ConfigurationManager.ConnectionStrings["VendorNewConnectionString"].ConnectionString;
-
SqlConnection Objcon = new SqlConnection(strcon);
-
//DataSet Questions = new DataSet();
-
DataTable dtGrid = new DataTable();
-
SqlDataAdapter da;
-
Objcon.Open();
-
SqlCommand oCmd = new SqlCommand("gridSelect", Objcon);
-
oCmd.CommandType = CommandType.StoredProcedure;
-
da = new SqlDataAdapter(oCmd);
-
da.Fill(dtGrid);
-
Objcon.Close();
-
gview.DataSource = dtGrid;
-
gview.DataBind();
-
}
-
-
-
-
//protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
-
//{
-
-
//}
-
-
//protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
-
//{
-
// gvVendor.EditIndex = e.NewEditIndex;
-
//}
-
-
protected void gview_RowUpdating(object sender, GridViewUpdateEventArgs e)
-
{
-
int rowindex = e.RowIndex;
-
-
TextBox TextBox1 = new TextBox();
-
TextBox1 = (TextBox)gview.Rows[rowindex].FindControl("txtaddress1");
-
string address1 = TextBox1.Text;
-
-
TextBox1 = (TextBox)gview.Rows[rowindex].FindControl("txtaddress2");
-
string address2 = TextBox1.Text;
-
-
TextBox1 = (TextBox)gview.Rows[rowindex].FindControl("txtVendorName");
-
string VendorName = TextBox1.Text;
-
-
TextBox1 = (TextBox)gview.Rows[rowindex].FindControl("txtAnnualrevenue");
-
int Annualrevenue = Convert.ToInt32(TextBox1.Text.ToString());
-
-
TextBox1 = (TextBox)gview.Rows[rowindex].FindControl("txtEmailId");
-
string EmailId = TextBox1.Text;
-
-
TextBox1 = (TextBox)gview.Rows[rowindex].FindControl("txtWebsite");
-
string Website = TextBox1.Text;
-
-
TextBox1 = (TextBox)gview.Rows[rowindex].FindControl("txtVendorSince");
-
DateTime VendorSince = Convert.ToDateTime(TextBox1.Text.ToString());
-
-
Label lblVendor = (Label)gview.Rows[rowindex].FindControl("lblVendorId");
-
int iVendorID = Convert.ToInt32(lblVendor.Text.ToString());
-
-
SqlConnection Objcon = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["VendorNewConnectionString"].ConnectionString);
-
Objcon.Open();
-
SqlCommand oCmd = new SqlCommand("sp_UpdateGrid", Objcon);
-
-
oCmd.Parameters.AddWithValue("@VendorName", VendorName);
-
oCmd.Parameters.AddWithValue("@Email", EmailId);
-
oCmd.Parameters.AddWithValue("@Website", Website);
-
oCmd.Parameters.AddWithValue("@Add1", address1);
-
oCmd.Parameters.AddWithValue("@Add2", address2);
-
oCmd.Parameters.AddWithValue("@VendorSince", VendorSince);
-
oCmd.Parameters.AddWithValue("@AnnRev", Annualrevenue);
-
oCmd.Parameters.AddWithValue("@VID", iVendorID);
-
-
oCmd.CommandType = CommandType.StoredProcedure;
-
oCmd.ExecuteNonQuery();
-
Response.Write("successfully updated");
-
Objcon.Close();
-
gridViewDataBind();
-
gview.EditIndex = -1;
-
}
-
-
protected void gview_RowEditing(object sender, GridViewEditEventArgs e)
-
{
-
gview.EditIndex = e.NewEditIndex;
-
}
-
-
protected void gview_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
-
{
-
gview.EditIndex = -1;
-
}
-
}
-
1 1380 Sign in to post your reply or Sign up for a free account.
Similar topics
by: Max Harvey |
last post by:
Hi,
I have looked at the example called "Open Parameter queries from code"
from the site http://www.mvps.org/access/queries/qry0003.htm
I made up a test which I though looked pretty close...
|
by: Santosh |
last post by:
Hii,
I am developing web application using asp.net with in that i am using
crytal report for showing reports. it works fine on local machine but
when i deploy it on the web server it gives me key...
|
by: tehxd |
last post by:
I having a table something like this:
startdate | stime | endate | etime | tool
3/3/07 | 8:47 | 3/4/07 | 00:30 | A
3/4/07 | 3:57 | 3/4/07 | 4:30 | B
3/4/07 | 8:21 | ...
|
by: smartchap009 |
last post by:
Adding,Updating and Deleting user using perl script in linux
--------------------------------------------------------------------------------
hi,
If i can get help in writing perl code for...
|
by: manjitsarma |
last post by:
In the following code I am getting the error-' the modifier public is not valid for this item'.Error is showing in 'getAvr'-
public interface student
{
public double...
|
by: nRk |
last post by:
Hi,
I am working on asp.net 2.0 with Visual Studio 2005. My asp.net
project contains one Masterpage.
I exposed my asp.net project in my machine (Windows XP with IIS 5.1)
and access using...
|
by: Smurfas |
last post by:
What's wrong?
Compiletor don't show anything, but whet I start program show this error:
"Error updating the employee details!"
protected void Button1_Click(object sender, EventArgs e)
...
|
by: Kosal |
last post by:
Dear All
Can you help me to convert as below code to vb.net module
Function GF_ListGroupsOfUser(ByVal stUserName As String) As String
On Error GoTo err_ListGroupsOfUser
Dim...
|
by: Leonidas Savvides |
last post by:
HOW detect EOF at below code? what put in place of
( i<3306 )
???
public mergerTxt()
{
try
{
File file = new File( "us-skype.lang" ); // get file name
File fileRu = new...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |