473,385 Members | 1,536 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,385 software developers and data experts.

Simple question

I get from database something like this:

DAY HOUR PRICE
---------------------------------------------
MONDAY 10 100
MONDAY 11 120
MONDAY 12 130
MONDAY 13 140
MONDAY 14 150
TUESDAY 11 90
TUESDAY 13 100
TUESDAY 15 110
TUESDAY 17 120
TUESDAY 18 130
TUESDAY 19 140
.....................

Now, I would like to show this on the page like this:

TIME AND PRICE FOR MONDAY
--------------------------------------------
Time:10 Price:100 DELETE button
Time:11 Price:120 DELETE button
Time:12 Price:130 DELETE button
Time:13 Price:140 DELETE button
Time:14 Price:150 DELETE button

TIME AND PRICE FOR TUESDAY
--------------------------------------------
Time:11 Price: 90 DELETE button
Time:13 Price:100 DELETE button
Time:15 Price:110 DELETE button
Time:17 Price:120 DELETE button
Time:18 Price:130 DELETE button
Time:19 Price:140 DELETE button

and so on.

When user clicks DELETE button, the row is removed and deleted from the
database.
What is the best way to do this?

Data grid or data repeater?

Any example? I don't know how to construct it. In asp it was easy with
response.write method and recordset

Thank you,
S
Nov 18 '05 #1
3 1745
Hi Simon,

The Best way i would choose is to play around with the DataSet in which you
have the Data
loop through the Dataset col / row collection in fashion that you want to
display. and build a new dataset and bind to Datagrid.

Thanks
Raghvendra

"simon" <si*********@stud-moderna.si> wrote in message
news:uA**************@TK2MSFTNGP10.phx.gbl...
I get from database something like this:

DAY HOUR PRICE
---------------------------------------------
MONDAY 10 100
MONDAY 11 120
MONDAY 12 130
MONDAY 13 140
MONDAY 14 150
TUESDAY 11 90
TUESDAY 13 100
TUESDAY 15 110
TUESDAY 17 120
TUESDAY 18 130
TUESDAY 19 140
....................

Now, I would like to show this on the page like this:

TIME AND PRICE FOR MONDAY
--------------------------------------------
Time:10 Price:100 DELETE button
Time:11 Price:120 DELETE button
Time:12 Price:130 DELETE button
Time:13 Price:140 DELETE button
Time:14 Price:150 DELETE button

TIME AND PRICE FOR TUESDAY
--------------------------------------------
Time:11 Price: 90 DELETE button
Time:13 Price:100 DELETE button
Time:15 Price:110 DELETE button
Time:17 Price:120 DELETE button
Time:18 Price:130 DELETE button
Time:19 Price:140 DELETE button

and so on.

When user clicks DELETE button, the row is removed and deleted from the
database.
What is the best way to do this?

Data grid or data repeater?

Any example? I don't know how to construct it. In asp it was easy with
response.write method and recordset

Thank you,
S

Nov 18 '05 #2
thank you.
do you have some example

Best regards,
Simon

"Raghavendra T V" <ra*****@hotmail.com> wrote in message
news:ud**************@tk2msftngp13.phx.gbl...
Hi Simon,

The Best way i would choose is to play around with the DataSet in which you have the Data
loop through the Dataset col / row collection in fashion that you want to
display. and build a new dataset and bind to Datagrid.

Thanks
Raghvendra

"simon" <si*********@stud-moderna.si> wrote in message
news:uA**************@TK2MSFTNGP10.phx.gbl...
I get from database something like this:

DAY HOUR PRICE
---------------------------------------------
MONDAY 10 100
MONDAY 11 120
MONDAY 12 130
MONDAY 13 140
MONDAY 14 150
TUESDAY 11 90
TUESDAY 13 100
TUESDAY 15 110
TUESDAY 17 120
TUESDAY 18 130
TUESDAY 19 140
....................

Now, I would like to show this on the page like this:

TIME AND PRICE FOR MONDAY
--------------------------------------------
Time:10 Price:100 DELETE button
Time:11 Price:120 DELETE button
Time:12 Price:130 DELETE button
Time:13 Price:140 DELETE button
Time:14 Price:150 DELETE button

TIME AND PRICE FOR TUESDAY
--------------------------------------------
Time:11 Price: 90 DELETE button
Time:13 Price:100 DELETE button
Time:15 Price:110 DELETE button
Time:17 Price:120 DELETE button
Time:18 Price:130 DELETE button
Time:19 Price:140 DELETE button

and so on.

When user clicks DELETE button, the row is removed and deleted from the
database.
What is the best way to do this?

Data grid or data repeater?

Any example? I don't know how to construct it. In asp it was easy with
response.write method and recordset

Thank you,
S


Nov 18 '05 #3
Simon,
You could do it that way... I found rather than abandon your ASP
experience, use the "Placeholder" control and just write the same
traditional HTML code in table format like you did in ASP...
You will likely need to use the Dataset Raghvendra suggests and you will
also want to add a Webform Button and have the clicks tracked on PostBack...

something like this (i hacked this from my code so code may not be
complete)...

Add Placeholder control to webform named "phGrid"

Private Sub LoadGrid(ByVal EID As Integer)
Dim strQuery As String
Dim oDA As SqlClient.SqlDataAdapter
Dim oDS As DataSet
Dim row As DataRow
Dim strOutput As New StringBuilder(1024)
Dim newLink As LinkButton
Try
oDS = New DataSet
strQuery = "Select * from Wherever Order By Whichever"
oDA = New SqlClient.SqlDataAdapter(strQuery,
MySvrConnectionString)
oDA.Fill(oDS, "MyData")
phGrid.Controls.Clear()
strOutput.Remove(0, strOutput.Length)
strOutput.Insert(0, "<table border=1 cellspacing=0 >")
phGrid.Controls.Add(New LiteralControl(strOutput.ToString)) '
output string to PHcontrol

For Each row In oDS.Tables("MyData").Rows
strOutput.Remove(0, strOutput.Length)
strOutput.Insert(0, " ")
strOutput.Append("<tr><td align=left>")
strOutput.Append(row("MyField1"))
strOutput.Append("</td><td align=center>")
phGrid.Controls.Add(New LiteralControl(strOutput.ToString))

newLink = New LinkButton
newLink.ID = "Delete" & row("MyUniqueRecordID")
newLink.Text = "Delete"
newLink.CommandArgument = row("MyField2")
AddHandler newLink.Click, AddressOf Delete_Click
phGrid.Controls.Add(newLink)

phGrid.Controls.Add(New LiteralControl("</td></tr>"))
Next
phGrid.Controls.Add(New LiteralControl("</table>"))

Catch ex As Exception
' output errors
Finally
If (Not oDA Is Nothing) Then
oDA.Dispose()
End If
If (Not oDS Is Nothing) Then
oDS.Dispose()
End If
End Try
End Sub

.... then be sure to create your "Delete_Click" sub to catch the postback and
delete the appropriate record from the table...

Hope this helps!
wardeaux

"Raghavendra T V" <ra*****@hotmail.com> wrote in message
news:ud**************@tk2msftngp13.phx.gbl...
Hi Simon,

The Best way i would choose is to play around with the DataSet in which you have the Data
loop through the Dataset col / row collection in fashion that you want to
display. and build a new dataset and bind to Datagrid.

Thanks
Raghvendra

"simon" <si*********@stud-moderna.si> wrote in message
news:uA**************@TK2MSFTNGP10.phx.gbl...
I get from database something like this:

DAY HOUR PRICE
---------------------------------------------
MONDAY 10 100
MONDAY 11 120
MONDAY 12 130
MONDAY 13 140
MONDAY 14 150
TUESDAY 11 90
TUESDAY 13 100
TUESDAY 15 110
TUESDAY 17 120
TUESDAY 18 130
TUESDAY 19 140
....................

Now, I would like to show this on the page like this:

TIME AND PRICE FOR MONDAY
--------------------------------------------
Time:10 Price:100 DELETE button
Time:11 Price:120 DELETE button
Time:12 Price:130 DELETE button
Time:13 Price:140 DELETE button
Time:14 Price:150 DELETE button

TIME AND PRICE FOR TUESDAY
--------------------------------------------
Time:11 Price: 90 DELETE button
Time:13 Price:100 DELETE button
Time:15 Price:110 DELETE button
Time:17 Price:120 DELETE button
Time:18 Price:130 DELETE button
Time:19 Price:140 DELETE button

and so on.

When user clicks DELETE button, the row is removed and deleted from the
database.
What is the best way to do this?

Data grid or data repeater?

Any example? I don't know how to construct it. In asp it was easy with
response.write method and recordset

Thank you,
S


Nov 18 '05 #4

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

Similar topics

3
by: Patchwork | last post by:
Hi Everyone, Please take a look at the following (simple and fun) program: //////////////////////////////////////////////////////////////////////////// ///////////// // Monster Munch, example...
1
by: Proteus | last post by:
Any help appreciated on a small perl project I need to write for educator/teaching purposes. I have not programmed perl for some time, need to get up to speed, maybe some kind souls hrere will help...
2
by: Raskolnikow | last post by:
Hi! I have a very simple problem with itoa() or the localtime(...). Sorry, if it is too simple, I don't have a proper example. Please have a look at the comments. struct tm *systime; time_t...
3
by: Peter | last post by:
Hello Thanks for reviewing my question. I would like to know how can I programmatically select a node Thanks in Advanc Peter
7
by: abcd | last post by:
I am trying to set up client machine and investigatging which .net components are missing to run aspx page. I have a simple aspx page which just has "hello world" printed.... When I request...
4
by: dba_222 | last post by:
Dear Experts, Ok, I hate to ask such a seemingly dumb question, but I've already spent far too much time on this. More that I would care to admit. In Sql server, how do I simply change a...
14
by: Giancarlo Berenz | last post by:
Hi: Recently i write this code: class Simple { private: int value; public: int GiveMeARandom(void);
30
by: galiorenye | last post by:
Hi, Given this code: A** ppA = new A*; A *pA = NULL; for(int i = 0; i < 10; ++i) { pA = ppA; //do something with pA
10
by: Phillip Taylor | last post by:
Hi guys, I'm looking to develop a simple web service in VB.NET but I'm having some trivial issues. In Visual Studio I create a web services project and change the asmx.vb file to this: Imports...
17
by: Chris M. Thomasson | last post by:
I use the following technique in all of my C++ projects; here is the example code with error checking omitted for brevity: _________________________________________________________________ /*...
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: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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
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.