Hi all,
I'm new to asp.net, and using Visual Web Dev express. As such I cannot
see the spreadsheet control and directly access the object properties
from the VB code in the back of my page.
I have declared it as an object as follows:
<object classid="clsid:0002E559-0000-0000-C000-000000000046"
id="Spreadsheet1" name="Spreadsheet1" style="width: 331px; height:
215px" >
note: all users have Office 2003 Web Components
Can only interact with this user entered data client-side, via
"document.all.item("Spreadsheet1").csvdata"
<input type=hidden id="TextBox1" name="TextBox1" />
Can only use this client side, so I can't get the contents of
spreadsheet in here and use it on the server. (If someone knows how it
can be done, please share )
<asp:TextBox ID="TextBox2" runat="server" TextMode="MultiLine"
AutoPostBack="True" Height="76px" Width="99px"
Visible="false"></asp:TextBox>
This is an asp box, so users can interact with, but it is not
recognized in client side vbscript. It works if I make it visible and
paste directly.
I was also unsuccessful at getting a javascript function to recognize
this textbox. I kept getting "Object Required" errors.
What I am trying to do is get the csvdata into my temp table. I tried
to do it in the following function (VB on back) and it works if I can
get the data:
Private Sub fnBeforePaste(ByVal txtPassed As String)
Dim i As Int32
Dim Idata() As String = Split(txtPassed, Chr(13) & Chr(10))
'or use Environment.Newline
If InStr(txtPassed, Environment.NewLine) Then
MsgBox("Environment.Newline")
For i = 0 To Idata.GetUpperBound(0) - 1
Dim stCells() As String = Split(Idata(i), Chr(9)) 'or
use ',' for csvdata
stCells(0) = Replace(stCells(0), Chr(10), "")
If Len(stCells(0)) < 2 Then GoTo ExitPasteGrid
AccessDataSource2.InsertCommand = "INSERT INTO Temptbl
(ESN,[MIN]) SELECT '" & stCells(0) & "' AS Expr1, '" & stCells(1) & "'
AS Expr2;"
'"INSERT INTO Temptbl ( ESN, [MIN] ) SELECT " & stCells(0)
& "," & stCells(1)
AccessDataSource2.Insert()
Next
ExitPasteGrid:
'TextBox2.Text = ""
GridEntry.DataBind()
End Sub
This way I can run a query in the database, and return the query
results in a second grid on the page. I have to use something easy for
users to enter two columns of unknown rows of numerical text values in
a temp table in order to join it to the other query table.
Any suggestions on how to approach this problem are much appreciated.
:) 1 2949
On 6 Dec 2006 11:26:34 -0800, "aspiring geek" <so*************@yahoo.comwrote:
>Hi all,
I'm new to asp.net, and using Visual Web Dev express. As such I cannot see the spreadsheet control and directly access the object properties from the VB code in the back of my page.
I have declared it as an object as follows: <object classid="clsid:0002E559-0000-0000-C000-000000000046" id="Spreadsheet1" name="Spreadsheet1" style="width: 331px; height: 215px" > note: all users have Office 2003 Web Components Can only interact with this user entered data client-side, via "document.all.item("Spreadsheet1").csvdata"
<input type=hidden id="TextBox1" name="TextBox1" /> Can only use this client side, so I can't get the contents of spreadsheet in here and use it on the server. (If someone knows how it can be done, please share )
Use Java Script:
TextBox1.value = aspnetForm.Spreadsheet1.csvData;
>
<asp:TextBox ID="TextBox2" runat="server" TextMode="MultiLine" AutoPostBack="True" Height="76px" Width="99px" Visible="false"></asp:TextBox> This is an asp box, so users can interact with, but it is not recognized in client side vbscript. It works if I make it visible and paste directly. I was also unsuccessful at getting a javascript function to recognize this textbox. I kept getting "Object Required" errors.
In your client side Java Script Code you need to reference this object
by the Client Side ID that ASP.Net assigns to it:
var myTextBox = aspnetForm.<%=TextBox2.clientID%>;
> What I am trying to do is get the csvdata into my temp table. I tried to do it in the following function (VB on back) and it works if I can get the data:
Private Sub fnBeforePaste(ByVal txtPassed As String)
Dim i As Int32
Dim Idata() As String = Split(txtPassed, Chr(13) & Chr(10))
'or use Environment.Newline
If InStr(txtPassed, Environment.NewLine) Then MsgBox("Environment.Newline")
For i = 0 To Idata.GetUpperBound(0) - 1
Dim stCells() As String = Split(Idata(i), Chr(9)) 'or use ',' for csvdata
stCells(0) = Replace(stCells(0), Chr(10), "")
If Len(stCells(0)) < 2 Then GoTo ExitPasteGrid
AccessDataSource2.InsertCommand = "INSERT INTO Temptbl (ESN,[MIN]) SELECT '" & stCells(0) & "' AS Expr1, '" & stCells(1) & "' AS Expr2;"
'"INSERT INTO Temptbl ( ESN, [MIN] ) SELECT " & stCells(0) & "," & stCells(1)
AccessDataSource2.Insert()
Next ExitPasteGrid:
'TextBox2.Text = ""
GridEntry.DataBind()
End Sub
This way I can run a query in the database, and return the query results in a second grid on the page. I have to use something easy for users to enter two columns of unknown rows of numerical text values in a temp table in order to join it to the other query table.
Any suggestions on how to approach this problem are much appreciated. :)
Try something like this:
Private Sub Save(ByVal CSV As String)
Dim oStream As New System.IO.StringReader(CSV)
Dim oFields As String() = {}
Using oParser As New TextFieldParser(oStream)
oParser.SetDelimiters(",")
While Not oParser.EndOfData
Try
oFields = oParser.ReadFields()
Try
'Validate Field Contents
Catch Ex As Exception
End Try
Catch ex As Exception
End Try
End While
End Using
End Function This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Hugh McLaughlin |
last post by:
Hello Everyone and thanks for your help in advance. I am
working on an application that requires the parsing of an
Excel spreadsheet that will be loaded into a SQL Server
table. An example of...
|
by: CDARS |
last post by:
Dear all,
I am working on a re-development project. The objective is to replace
an old "system", which make use of local MS Excel, with a new
web-based application.
Platform: SQL2K, Windows...
|
by: Axe |
last post by:
Here's the problem: I've got an ASP.NET (C#) web page that has a single
<input type=file> control on it for uploading a file. The way the code
works is that the uploaded file is then parsed for...
|
by: Rob Meade |
last post by:
Hi all,
I have a loop in my code which builds the controls on the page.
I at one stage need to add some hidden input controls dynamically, I have
achieved this, and I have set their...
|
by: Tom |
last post by:
Hello,
I'm looking for a tool that would allow me to create a web page with the
spreadsheet like functionality. Basically, I want to be able to type in a
number in the cell and have all totals...
|
by: Brooke |
last post by:
I am new to ASP.NET, but have been programming for about 14 years (C#
about 2 years). My manager asked me to develop a web application that would
allow employees to view a spreadsheet that is used...
|
by: colo |
last post by:
Hi,
I'm trying to create a web app that will allow users to input several
rows of data for several columns. Is there a control that simulates
the flexibility of a spreadsheet? This app is...
|
by: Duncan Smith |
last post by:
Hello,
I am currently implementing (mainly in Python) 'models' that come
to me as Excel spreadsheets, with little additional information. I am
expected to use these models in a web application. ...
|
by: mix01 |
last post by:
Hi,
I am trying to get some VBA code working, but am preplex as to why it does not work. I would really appreciate any level of help.
Many thanks,
Mix01
Version of the program
|
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
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
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: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |