Showing posts with label rows. Show all posts
Showing posts with label rows. Show all posts

Monday, March 26, 2012

Populate dataGrid

I would like to have 24 rows (one for each hour - from 0 to 24h).
Than I have some meetings at some hour and different subjects for each
meeting.

So I should have 24 rows, and if there is some meeting at some hour, there
should be displayed that meeting with all subjects in one cell.

I can get data from database in order like that:

hour meeting subject

9 meeting1 subject1
9 meeting1 subject2
9 meeting1 subject3
10 meeting2 subject1

....and so on

My cell should be displayed like this (for hour 9 for example):

| 9 meeting1
| subject1
| subject2
| subject3
_____________
|10 meeting2
| subject1

Every meeting and subjects displayed are links to the page with subject or
meeting.
What should I use? Can I use data grid? If i populate it with my sql data
then I get more than 24 rows.

Is there some idea?

Thank you,
SimonYou can but you will need to do some editing by hand.

To get things in the right format before using the data in the grid.

"simon" <simon.zupan@.stud-moderna.si> wrote in message
news:u5z3t4OtDHA.1060@.TK2MSFTNGP12.phx.gbl...
> I would like to have 24 rows (one for each hour - from 0 to 24h).
> Than I have some meetings at some hour and different subjects for each
> meeting.
> So I should have 24 rows, and if there is some meeting at some hour, there
> should be displayed that meeting with all subjects in one cell.
> I can get data from database in order like that:
> hour meeting subject
> 9 meeting1 subject1
> 9 meeting1 subject2
> 9 meeting1 subject3
> 10 meeting2 subject1
> ...and so on
> My cell should be displayed like this (for hour 9 for example):
> | 9 meeting1
> | subject1
> | subject2
> | subject3
> _____________
> |10 meeting2
> | subject1
> Every meeting and subjects displayed are links to the page with subject or
> meeting.
> What should I use? Can I use data grid? If i populate it with my sql data
> then I get more than 24 rows.
> Is there some idea?
> Thank you,
> Simon
How do you mean to get things in the right format?
Change sql query or check each row in datagrid when creating and move to the
next row if the row for hour 9 for example was already created (that way I
would probably get 24 rows I needed, but still I should design cell
somehow)?

Do you have some example?

Thank you for your answer,
Simon

"Aemca" <Aemca@.none.com> wrote in message
news:OLbI6CPtDHA.2088@.TK2MSFTNGP09.phx.gbl...
> You can but you will need to do some editing by hand.
> To get things in the right format before using the data in the grid.
>
>
> "simon" <simon.zupan@.stud-moderna.si> wrote in message
> news:u5z3t4OtDHA.1060@.TK2MSFTNGP12.phx.gbl...
> > I would like to have 24 rows (one for each hour - from 0 to 24h).
> > Than I have some meetings at some hour and different subjects for each
> > meeting.
> > So I should have 24 rows, and if there is some meeting at some hour,
there
> > should be displayed that meeting with all subjects in one cell.
> > I can get data from database in order like that:
> > hour meeting subject
> > 9 meeting1 subject1
> > 9 meeting1 subject2
> > 9 meeting1 subject3
> > 10 meeting2 subject1
> > ...and so on
> > My cell should be displayed like this (for hour 9 for example):
> > | 9 meeting1
> > | subject1
> > | subject2
> > | subject3
> > _____________
> > |10 meeting2
> > | subject1
> > Every meeting and subjects displayed are links to the page with subject
or
> > meeting.
> > What should I use? Can I use data grid? If i populate it with my sql
data
> > then I get more than 24 rows.
> > Is there some idea?
> > Thank you,
> > Simon

Wednesday, March 21, 2012

populated a dropdown with data in the rows, but populating a dropdown with names of the co

within my pageload i have
SqlConnection rate;
SqlCommand Selct;
SqlDataReader dbresults;
rate = new SqlConnection( @dotnet.itags.org."xoxo");
rate.Open();
Selct = new SqlCommand( "Select UserID From dbo.Users", rate );
dbresults = Selct.ExecuteReader();
DropDownList1.DataSource = dbresults;
DropDownList1.DataTextField = "UserID*";
DropDownList1.DataBind();
dbresults.Close();
rate.Close();try out

...
myda = New SqlClient.SqlDataAdapter("Select * from <tablename>" , myconnection)
ds = New DataSet()
myda.Fill(ds, "TableName")
Dim dc As DataColumn
For Each dc In ds.Tables(0).Columns
ddl.Items.Add(dc.ColumnName)
Next
.....

HTH
ok heres another one ive been trying to figure out , how do a populate a drop down list with each table name in a database

Populating 2 dim array.

Hello, I have a 7 column data table in ADO.net with 200 rows. I want to learn how to copy the data in my data table to myarray (6,199) as Integar.

Dim myarray (6, 199) As Integar??

For Each myarray In myDataSet.Tables??

??

??

Next??

Hello my friend,

Use the following: -

Dim myarray(6, 199) As Integer

For i As Integer = 0 To dt.Rows.Count - 1

For j As Integer = 0 To dt.Columns.Count - 1
myarray(i, j) = Convert.ToInt32(dt.Rows(i).Item(j))
Next
Next

Kind regards

Scotty

Populating a DropDownList

Is there a way to manually insert rows into a dropdownlist.
I nneed to insert a value and a display text.Yes, you may use " DropDownList.Items.Add" or "Items.Insert".
How do you add a value and a display text?
ddlb.Add("50","New York") does not work. It appears to only take one argument.
OK. Do it like this:

Dim newItem As ListItem = New ListItem("New York", "50")
ddlb.Items.Add(newItem)

This will add a new item at bottom of your DDL, if you want add it in a certain palce, you amy do like this:

ddlb.Items.Insert(0,newItem)

This will add it in the very top.