JessyRobinson1234
asked on
How to make one gridview field editable through VB code?
I have the following application:
I am trying to make the Lineas Auditads an editable field in my gridview through the VB code. Can someone help?
I am trying to make the Lineas Auditads an editable field in my gridview through the VB code. Can someone help?
Dim dt As DataView
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Chart1.ChartAreas(0).AxisY.MajorGrid.LineColor = Color.LightGray
Chart1.ChartAreas(0).AxisY2.MajorGrid.LineColor = Color.LightGray
Chart1.ChartAreas(0).AxisX.MajorGrid.LineColor = Color.Transparent
Chart1.ChartAreas(0).AxisX.LabelStyle.Font = New Font("Arial", 8)
Chart1.ChartAreas(0).AxisY.LabelStyle.Font = New Font("Arial", 8)
Chart1.ChartAreas(0).AxisY2.LabelStyle.Font = New Font("Arial", 8)
Chart1.CallbackStateContent = CallbackStateContent.SeriesDataOnly
Me.Page.ClientScript.RegisterStartupScript(GetType(Dundas.Charting.WebControl.Chart), "Chart1_Callback", "window.setInterval(""" + Chart1.CallbackManager.GetCallbackAsyncMethodReference(Timer, "") + """, 60000);", True)
Chart1.Titles(0).Text = "% de Lineas Auditadas de Ensamble"
Dim dtmTest As Date
Dim strShift As String
Dim sqlStr As String
dtmTest = TimeOfDay
Select Case dtmTest
Case "6:50:00 AM" To "12:50:00 PM"
strShift = "1"
sqlStr = "select l.line as [Linea],isnull(e.Total_Qty, 0) as [QTY de Lineas de Ensamble],isnull(e.Progress_Qty, 0) as [Lineas Auditadas],isnull ( round(( e.Progress_Qty * 100)/e.Total_Qty,0), 0) as [Progreso] from Lenovo_Lines l LEFT Join Lenovo_Events e ON e.Line_Key = l.Line_Key AND e.Event_Date >= CONVERT(datetime, CONVERT(VARCHAR(10), GETDATE(), 120) , 120) AND e.Event_Date < CONVERT(datetime, CONVERT(VARCHAR(10), GETDATE() + 1, 120) , 120) and shift_Key =1"
Case "12:50:00 PM" To "6:50:00 PM"
strShift = "2"
sqlStr = "select l.line as [Linea],isnull(e.Total_Qty, 0) as [QTY de Lineas de Ensamble],isnull(e.Progress_Qty, 0) as [Lineas Auditadas],isnull ( round(( e.Progress_Qty * 100)/e.Total_Qty,0), 0) as [Progreso] from Lenovo_Lines l LEFT Join Lenovo_Events e ON e.Line_Key = l.Line_Key AND e.Event_Date >= CONVERT(datetime, CONVERT(VARCHAR(10), GETDATE(), 120) , 120) AND e.Event_Date < CONVERT(datetime, CONVERT(VARCHAR(10), GETDATE() + 1, 120) , 120) and shift_Key =2"
Case "6:50:00 PM" To "12:50:00 AM"
strShift = "3"
sqlStr = "select l.line as [Linea],isnull(e.Total_Qty, 0) as [QTY de Lineas de Ensamble],isnull(e.Progress_Qty, 0) as [Lineas Auditadas],isnull ( round(( e.Progress_Qty * 100)/e.Total_Qty,0), 0) as [Progreso] from Lenovo_Lines l LEFT Join Lenovo_Events e ON e.Line_Key = l.Line_Key AND e.Event_Date >= CONVERT(datetime, CONVERT(VARCHAR(10), GETDATE(), 120) , 120) AND e.Event_Date < CONVERT(datetime, CONVERT(VARCHAR(10), GETDATE() + 1, 120) , 120) and shift_Key =3"
Case "12:50:00 AM" To "6:50:00 AM"
strShift = "4"
sqlStr = "select l.line as [Linea],isnull(e.Total_Qty, 0) as [QTY de Lineas de Ensamble],isnull(e.Progress_Qty, 0) as [Lineas Auditadas],isnull ( round(( e.Progress_Qty * 100)/e.Total_Qty,0), 0) as [Progreso] from Lenovo_Lines l LEFT Join Lenovo_Events e ON e.Line_Key = l.Line_Key AND e.Event_Date >= CONVERT(datetime, CONVERT(VARCHAR(10), GETDATE(), 120) , 120) AND e.Event_Date < CONVERT(datetime, CONVERT(VARCHAR(10), GETDATE() + 1, 120) , 120) and shift_Key =4"
End Select
Dim sConn As String = ConfigurationManager.ConnectionStrings("BusDevConnectionString").ToString
Dim myConnection As SqlConnection = New SqlConnection(sConn)
Dim myCommand As SqlDataAdapter = New SqlDataAdapter
myCommand = New SqlDataAdapter(sqlStr, myConnection)
Dim ds As DataSet = New DataSet()
myCommand.Fill(ds)
Dim source As New DataView(ds.Tables(0))
Chart1.DataSource = source
Chart1.Series(0).ValueMemberX = "Linea"
Chart1.Series(0).ValueMembersY = "Progreso"
Chart1.DataBind()
GridView1.AutoGenerateSelectButton = False
GridView1.DataSource = dt
GridView1.DataBind()
Dim sqlStrGV As String
Dim Conn As String = ConfigurationManager.ConnectionStrings("BusDevConnectionString").ToString
Dim myGVConnection As SqlConnection = New SqlConnection(Conn)
sqlStrGV = sqlStr
Dim myCommandGV As SqlDataAdapter = New SqlDataAdapter
myCommandGV = New SqlDataAdapter(sqlStrGV, myGVConnection)
GridView1.AutoGenerateSelectButton = True
Dim dsGV As DataSet = New DataSet()
myCommandGV.Fill(dsGV)
Dim sourceGV As DataView
sourceGV = New DataView(dsGV.Tables(0))
GridView1.AutoGenerateSelectButton = False
GridView1.DataSource = sourceGV
GridView1.DataMember = dsGV.Tables(0).TableName
GridView1.DataBind()
GridView1.AllowSorting = True
Session("DataSource") = sourceGV
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
And the code that sets the parameter values?
ASKER
I've requested that this question be closed as follows:
Accepted answer: 0 points for JessyRobinson1234's comment #a38830637
for the following reason:
thank you I got it working
Accepted answer: 0 points for JessyRobinson1234's comment #a38830637
for the following reason:
thank you I got it working
Without any help from here?
Either select the comment which helped or delete the question.
Split between http:#a38820762 and http:#a38825967
ASKER
Here's my code:
Open in new window
Stored Procedure:
Open in new window