473,378 Members | 1,375 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

grid view RowUpdating problem

Hi.

I have some problems using gridview bind to a datatable: i can't get
updated values in then RowUpdating : i think the problem is that the
datasource is nothing...
I'm not using visual datasources due to the complex sql string and
different database targets.

Is it possible to get new values from RowUpdating ?
This is the code:
Partial Class Soggetti
Inherits System.Web.UI.Page
Private Dt As Data.DataTable
Private Dr As Data.DataRow
Private Dtc As Data.DataTable
Private Sub RebindCOntatti()
Dtc = MainClass.GetDtContatti(Session("Par"),
Me.CodiceTextBox.Text)
Me.GridContatti.DataSource = Dtc

Me.GridContatti.DataBind()
End Sub
Private Sub VuotaCampi()
Me.CodiceTextBox.Text = ""
Me.CodiceNascosto.Value = ""
Me.RagSocTextBox.Text = ""
Me.PIVATextBox.Text = ""
Me.GridContatti.DataSource = Nothing

End Sub
Private Sub RiempiCampi()
VuotaCampi()
If Not IsNothing(Dr) Then
Me.CodiceTextBox.Text = MainClass.Nz(Dr("Cliente"), "")
Me.CodiceNascosto.Value = MainClass.Nz(Dr("Cliente"), "")
Me.RagSocTextBox.Text = MainClass.Nz(Dr("RagSociale"), "")
Me.PIVATextBox.Text = MainClass.Nz(Dr("PIVA"), "")
Me.IndiTextBox.Text = MainClass.Nz(Dr("Indirizzo"), "")
MainClass.SetComboValue(Dr, "Lingua",
Me.LinguaDropDownList)
MainClass.SetComboValue(Dr, "CodValuta",
Me.ValutaDropDownList)
MainClass.SetComboValue(Dr, "CodListino",
Me.ListinoDropDownList)
MainClass.SetComboValue(Dr, "CodListinoRicambio",
Me.ListinoRicambiDropDownList)
MainClass.SetComboValue(Dr, "CodScontoQtaPrRicambio",
Me.ListinoQtaDropDownList)
RebindCOntatti()

End If
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
Dt = Nothing
Dr = Nothing
If Not Me.IsPostBack Then
MainClass.PopolaCBValute(Session("Par"),
Me.ValutaDropDownList)
MainClass.PopolaCBListino(Session("Par"),
Me.ListinoDropDownList)
MainClass.PopolaCBListino(Session("Par"),
Me.ListinoRicambiDropDownList)
MainClass.PopolaCBLingua(Session("Par"),
Me.LinguaDropDownList)
Else
If Me.CodiceNascosto.Value <"" Then
Dt = MainClass.FindDTSoggetti(Session("Par"),
Me.CodiceNascosto.Value, "", True)
If Not IsNothing(Dt) Then
If Dt.Rows.Count 0 Then
Dr = Dt.Rows(0)
End If
End If
RiempiCampi()

End If

End If
End Sub

Protected Sub SaveButton_Click(ByVal sender As Object, ByVal e As
System.Web.UI.ImageClickEventArgs) Handles SaveButton.Click
MainClass.SalvaCliente(Session("Par"), Me.CodiceTextBox.Text,
Me.RagSocTextBox.Text, Me.IndiTextBox.Text, Me.PIVATextBox.Text,
Me.ValutaDropDownList.SelectedValue,
Me.LinguaDropDownList.SelectedValue,
Me.ListinoDropDownList.SelectedValue,
Me.ListinoRicambiDropDownList.SelectedValue, Me.PrzTextBox.Text,
Me.ScoTextBox.Text, Me.ListinoQtaDropDownList.SelectedValue)
Me.CodiceNascosto.Value = Me.CodiceTextBox.Text

End Sub

Protected Sub NewButton_Click(ByVal sender As Object, ByVal e As
System.Web.UI.ImageClickEventArgs) Handles NewButton.Click
Me.CodiceTextBox.Text = ""
Me.CodiceNascosto.Value = ""
VuotaCampi()
End Sub

Protected Sub LinkButton1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles LinkButton1.Click
Mw.ActiveViewIndex = 0

End Sub

Protected Sub LinkButton2_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles LinkButton2.Click
Mw.ActiveViewIndex = 1
RebindCOntatti()
End Sub

Protected Sub GridContatti_PageIndexChanging(ByVal sender As
Object, ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs)
Handles GridContatti.PageIndexChanging
Me.GridContatti.PageIndex = e.NewPageIndex
Me.GridContatti.Page.DataBind()
End Sub

Protected Sub GridContatti_RowCancelingEdit(ByVal sender As Object,
ByVal e As System.Web.UI.WebControls.GridViewCancelEditEventA rgs)
Handles GridContatti.RowCancelingEdit
GridContatti.EditIndex = -1
RebindCOntatti()
Me.Mw.ActiveViewIndex = 1
End Sub

Protected Sub GridContatti_RowCommand(ByVal sender As Object, ByVal
e As System.Web.UI.WebControls.GridViewCommandEventArgs ) Handles
GridContatti.RowCommand

End Sub

Protected Sub GridContatti_RowEditing(ByVal sender As Object, ByVal
e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles
GridContatti.RowEditing
Me.Mw.ActiveViewIndex = 1
Me.CodiceNascosto.Value = ""

Me.GridContatti.Attributes.Add("OldValuesParameter FormatString",
"original_{0}")
Me.GridContatti.EditIndex = e.NewEditIndex
RebindCOntatti()
Me.Mw.ActiveViewIndex = 1
End Sub

Protected Sub GridContatti_RowUpdating(ByVal sender As Object,
ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles
GridContatti.RowUpdating
Dim S As String = ""
Dim I As Integer = e.RowIndex
Dim C, Se, CC, N, T, F, em, CE As String

Me.Mw.ActiveViewIndex = 1
'RebindCOntatti()
'Me.GridContatti.EditIndex = I
C = MainClass.GetGridCellValue(Me.GridContatti, I, 0)
Se = MainClass.GetGridCellValue(Me.GridContatti, I, 2)
CC = MainClass.GetGridCellValue(Me.GridContatti, I, 3)
N = MainClass.GetGridCellValue(Me.GridContatti, I, 4)
T = MainClass.GetGridCellValue(Me.GridContatti, I, 5)
F = MainClass.GetGridCellValue(Me.GridContatti, I, 6)
em = MainClass.GetGridCellValue(Me.GridContatti, I, 7)
CE = MainClass.GetGridCellValue(Me.GridContatti, I, 8)
'MainClass.SalvaContatto(Session("Par"), C, Se, CC, N, T, F,
em, CE)


End Sub
End Class

Oct 31 '06 #1
0 1208

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Programatix | last post by:
Hi, I'm working on a WebService project. I'm trying to validate data before they are updated to the database by handling the RowUpdating event for a SqlDataAdapter. The data being handled has...
10
by: John Wilson | last post by:
My app produces some long datatables to display in a grid. So I put them in a div so users can scroll. But the grid headers scroll out of view. I would like to stop them doing this. Can I fix them...
1
by: Ed | last post by:
hi everyone, maybe someone can give me a hand here. I am working with vb 2005 and i have a gridview that i am loading data from a recordset. I have the recordset returned from the query and i am...
2
by: Umeshnath | last post by:
Hi, I have placed a grid view inside Atlas panel. On click of a button event, data is populated in the grid view, I want to add scroll bar instead of increasing the size of grid view. I have...
3
by: slemen | last post by:
The controls (textboxes) in the gridview row being updated have the old, pre user updated values in the RowUpdating event. Does anyone have an idea why? Thank you, Scott
1
by: =?Utf-8?B?TG95b2xhIHN0YWxpbg==?= | last post by:
Hi, I am using ASP.Net 2.0 version and Windows'XP OS. I am useing the Grid view control to display the user details along with the paging concept provided by the grid view control. When i...
1
by: rogerford | last post by:
I have a grid which i bind with values from Database. I have events to edit and update the grid. I am not using SqlDatasource to connect to DB. Rather i am doing the updating of the grid...
0
by: steve | last post by:
I have been fighting with trying to update a GridView for a while. I don't want to use the "built-in" way to do it because I am using business layer methods for updating and deleteing and I don't...
4
by: Bobby Edward | last post by:
I have some custom rowupdating code in my gridview. The user clicks edit, edits the record, clicks update and it runs my code. The code runs fine but the row is still in an 'update' mode. How...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
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...
1
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...
0
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 using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.