473,378 Members | 1,400 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.

datagrid not displaying on the form after datagrid1.DataBind( )

Hello,

I have a web form that allows the user to move a unit on a
manufacturing router. The user click one of five buttons which each
represent a step on the router. When the user clicks any of the five
buttons, I do a SQL select to gather some data about this unit and
populate a datagrid w/ the resulting data. I want the data in the
datagrid to be displayed to the user, and THEN I want to prompt the
user w/ a messagebox(), that ask them "Do you want to process this
move request? YES or NO". The problem is when I bind the datagrid it
does NOT display on the form until after the user answers the YES or
NO question, even though I load and bind the datagrid before I prompt
the user w/ the MESSAGEBOX() function. What do I need to do, to have
the datagrid data displayed before the MESSAGEBOX pops up, so the user
can see the datagrid data to make the right answer to the MESSAGEBOX?
The code is listed below. Any help will be greatly appreciated.
Thanks...


NOTE: some of the variables used in the functions are declared
earlier
public

user clicks one of the five router step buttons
and the ConfirmRequest() function is called
Private Function ConfirmRequest(ByVal ToOperation As String) As
String
Dim Result1 As Boolean
Dim UpdateDatabaseResponse As String
Dim Message As String = "Do you want to process this move
request?"
Dim Caption As String = "A T T E N T I O N!!"
Dim Buttons As MessageBoxButtons = MessageBoxButtons.YesNo
Dim Result As DialogResult
'Call the function that loads & binds the datagrid w/ this
units data.
Result1 = DispComponentData("PARAM1")
Result = MessageBox.Show(Message, Caption,
MessageBoxButtons.YesNo, _
MessageBoxIcon.Question, MessageBoxDefaultButton.Button1,
MessageBoxOptions.ServiceNotification)
' If the user clicked YES to this response we will proceede to
update
the MFG Items & Active Tables.
If Result = DialogResult.Yes Then
UpdateDbResponse = UpdateDatabase(ToOperation, "parm2",
"parm3")
Return "YES"
Else
Return "NO"
End If
End Function
Private Function DispComponentData(ByVal param1 As String) As
Boolean
Dim myConnection As OleDbConnection
Dim myCommand As OleDbDataAdapter
Dim ds As New DataSet()
Dim ConnStr As String
Dim SQL As String
'Connection syntax
ConnStr = "Provider=OraOLEDB.Oracle.1;Persist Security
Info=False;User ID=sfdm;Password=icc8336;Data
Source=housys.world;Extended Properties="
myConnection = New OleDbConnection(ConnStr)
'DataSetCommand

' N O T I C E: Take the hardcoded values out of this code.
Replace w/ the variables.
SQL = "SELECT b.comppart||' '||b.comprevision AS
COMP_REV,b.CompSFCnumber,NEW_TIME(TO_DATE('010170' ,'mmddrr') +
b.tstamp/86400,'GMT','CST') EnteredDate "
SQL = SQL + "FROM BUILDHISTORY b,ROUTSTEP r "
SQL = SQL + "WHERE b.sfcnumber = 'EA03LDNB2W' "
SQL = SQL + "AND b.step >= 20 "
SQL = SQL + "AND b.status = 'ACTIVE' "
SQL = SQL + "AND r.routername = 'ECG' "
SQL = SQL + "AND b.step = r.step(+) "
SQL = SQL + "ORDER BY b.tstamp"

'SQL = "select * from Masters"
myCommand = New OleDbDataAdapter(SQL, myConnection)
'use Fill method of DataSetCommand to populate dataset
myCommand.Fill(ds, "BUILDHISTORY")
Me.DataGrid1.Visible = True
'Binding a Grid
Me.DataGrid1.DataSource =
ds.Tables("BUILDHISTORY").DefaultView
Me.DataGrid1.DataBind()
Me.DataGrid1.Visible = True
myConnection.Close()
Return True
End Function
Nov 20 '05 #1
0 1560

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

Similar topics

3
by: Stephen | last post by:
I've got a datagrid with a remove button and I would like to add some code in the code behind page so as whenthe button is clicked the corresponding row in the datagrid is removed. The Datagrid is...
0
by: Reb | last post by:
I am using a datagrid within another datagrid. My second datagrid is expand/collapse one. I am facing some error. This is my code. ExpandGrid.aspx <form id="Form1" method="post"...
3
by: Jim Heavey | last post by:
Trying to figure out the technique which should be used to add rows to a datagrid. I am thinking that I would want an "Add" button on the footer, but I am not quite sure how to do that. Is that...
3
by: DC | last post by:
Dear ASP.Net Experts, In ASP, I can write something like this: <table> <tr> <th align=left>ID</th> <th align=left>Product Name</th> <th align=left>Price</th> </tr> <%
7
by: DC Gringo | last post by:
I have a datagrid that won't sort. The event handler is firing and return label text, just not the sort. Here's my Sub Page_Load and Sub DataGrid1_SortCommand: -------------------- Private...
3
by: CVerma | last post by:
Hi, I have an embedded datagrid within a datalist. I am not able to perfrom paging in the datagrid. Any ideas? Here is my code: Here is my Simplegrid.cs file: using System; using...
9
by: A P | last post by:
Hi! I have created a sample datagrid that can update data on a database. Please help me solve the problem, I have attached both aspx and code behind (aspx.vb): ______________________ ...
5
by: tshad | last post by:
Is there a way to carry data that I have already read from the datagrid from page to page? I am looking at my Datagrid that I page through and when the user says get the next page, I have to go...
0
by: rupalirane07 | last post by:
Both grids displays fine. But the problem is only parent datagrid sorting works fine but when i clik on child datagrid for sorting it gives me error: NullReferenceException error Any...
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
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...

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.