Zwischen zwei ObjectDataSources per CodeBehind wechseln

07/10/2008 - 14:39 von Jürgen Schulz | Report spam
Hi,
kann man eigentlich bei der Datenbindung an ein FormView zwischen 2 verschiedenen
ObjectDataSources wechseln. Wenn ja, welches wàre das geeignete Event dafür und worauf
ist besonders zu achten?

Gruss Jürgen
 

Lesen sie die antworten

#1 Frank M
09/10/2008 - 00:13 | Warnen spam
ich hab ma sowas àhnliches gemacht aber ist ne blöde lösung..
meinste sowas???


Dim auswahl As Integer = DropDownList1.SelectedValue.ToString
Select Case auswahl
Case 5000
Label10.Text = "alle"
DataList2.DataSourceID = "Sqlalle"
DataList2.DataKeyField = "personid"
DataList2.DataBind()
DataList2.SelectedIndex = -1
DataList1.Visible = True
DataList1.SelectedIndex = 0
DataList1.DataBind()
Label1.Text = "Nachname beginnend mit: " &
DataList1.SelectedValue.ToString
Case 5001
Label10.Text = "mdb"
DataList2.DataSourceID = "Sqlmdb"
DataList2.DataKeyField = "personid"

DataList2.DataBind()
DataList2.SelectedIndex = -1
Label1.Text = "MdB"
Case 5002
Label10.Text = "AK I"
DataList2.DataSourceID = "Sqlak1"
DataList2.DataKeyField = "personid"
DataList2.SelectedIndex = -1
DataList2.DataBind()
DataList1.SelectedIndex = 0
DataList1.DataBind()
Label1.Text = "AK I"
Case 5003
Label10.Text = "AK II"
DataList2.DataSourceID = "Sqlak2"
DataList2.DataKeyField = "personid"
DataList2.SelectedIndex = -1
DataList2.DataBind()
DataList1.SelectedIndex = 0
DataList1.DataBind()
Label1.Text = "AK II"
Case 5004
Label10.Text = "AK III"
DataList2.DataSourceID = "Sqlak3"
DataList2.DataKeyField = "personid"
DataList2.SelectedIndex = -1
DataList2.DataBind()
DataList1.SelectedIndex = 0
DataList1.DataBind()
Label1.Text = "AK III"
Case 5005
Label10.Text = "AK IV"
DataList2.DataSourceID = "Sqlak4"
DataList2.DataKeyField = "personid"
DataList2.SelectedIndex = -1
DataList2.DataBind()
DataList1.SelectedIndex = 0
DataList1.DataBind()
Label1.Text = "AK IV"
Case 5006
Label10.Text = "AK V"
DataList2.DataSourceID = "Sqlak5"
DataList2.DataKeyField = "personid"
DataList2.SelectedIndex = -1
DataList2.DataBind()
DataList1.SelectedIndex = 0
DataList1.DataBind()
Label1.Text = "AK V"
Case 5007
Label10.Text = "AK VI"
DataList2.DataSourceID = "Sqlak6"
DataList2.DataKeyField = "personid"
DataList2.SelectedIndex = -1
DataList2.DataBind()
DataList1.SelectedIndex = 0
DataList1.DataBind()
Label1.Text = "AK VI"
Case 5008
DataList2.DataSourceID = "Sqlfrakserv"
DataList2.DataKeyField = "personid"
DataList2.SelectedIndex = -1
DataList2.DataBind()
DataList1.SelectedIndex = 0
DataList1.DataBind()
Label1.Text = "Fraktionsservice"
Case 5009
DataList2.DataSourceID = "Sqlpresse"
DataList2.DataKeyField = "personid"
DataList2.SelectedIndex = -1
DataList2.DataBind()
DataList1.SelectedIndex = 0
DataList1.DataBind()
Label1.Text = "Pressestelle"
Case 5010
DataList2.DataSourceID = "Sqlges"
DataList2.DataKeyField = "personid"
DataList2.SelectedIndex = -1
DataList2.DataBind()
DataList1.SelectedIndex = 0
DataList1.DataBind()
Label1.Text = "Geschàftsführung"
Case 5011
DataList2.DataSourceID = "Sqlfin"
DataList2.DataKeyField = "personid"
DataList2.SelectedIndex = -1
DataList2.DataBind()
DataList1.SelectedIndex = 0
DataList1.DataBind()
Label1.Text = "Finanzen und Personal"
Case 5012
DataList2.DataSourceID = "Sqlparla"
DataList2.DataKeyField = "personid"
DataList2.SelectedIndex = -1
DataList2.DataBind()
DataList1.SelectedIndex = 0
DataList1.DataBind()
Label1.Text = "Parlamentarische Geschàftsführung"
Case 5013
DataList2.DataSourceID = "Sqlbund"
DataList2.DataKeyField = "personid"
DataList2.SelectedIndex = -1
DataList2.DataBind()
DataList1.SelectedIndex = 0
DataList1.DataBind()
Label1.Text = "Bund-Lànder-Koordination"
Case 5014
DataList2.DataSourceID = "Sqlvor"
DataList2.DataKeyField = "personid"
DataList2.SelectedIndex = -1
DataList2.DataBind()
DataList1.SelectedIndex = 0
DataList1.DataBind()
Label1.Text = "Vorstandsbüro"
Case 5015
DataList2.DataSourceID = "Sqlmed"
DataList2.DataKeyField = "personid"
DataList2.SelectedIndex = -1
DataList2.DataBind()
DataList1.SelectedIndex = 0
DataList1.DataBind()
Label1.Text = "Medien- und Öffentlichkeitsarbeit"
Case 5016
DataList2.DataSourceID = "Sqlit"
DataList2.DataKeyField = "personid"
DataList2.SelectedIndex = -1
DataList2.DataBind()
DataList1.SelectedIndex = 0
DataList1.DataBind()
Label1.Text = "IT und Organisation"
Case 5017
DataList2.DataSourceID = "Sqlkon"
DataList2.DataKeyField = "personid"
DataList2.SelectedIndex = -1
DataList2.DataBind()
DataList1.SelectedIndex = 0
DataList1.DataBind()
Label1.Text = "Kontaktstelle soziale Bewegungen"
Case 5018
DataList2.DataSourceID = "Sqljustiz"
DataList2.DataKeyField = "personid"
DataList2.SelectedIndex = -1
DataList2.DataBind()
DataList1.SelectedIndex = 0
DataList1.DataBind()
Label1.Text = "Justiziariat"
Case 5019
DataList2.DataSourceID = "Sqlfem"
DataList2.DataKeyField = "personid"
DataList2.SelectedIndex = -1
DataList2.DataBind()
DataList1.SelectedIndex = 0
DataList1.DataBind()
Label1.Text = "Frauenpolitische Sprecherin"
Case 5020
DataList2.DataSourceID = "Sqlmdbma"
DataList2.DataKeyField = "personid"
DataList2.SelectedIndex = -1
DataList2.DataBind()
DataList1.SelectedIndex = 0
DataList1.DataBind()
Label1.Text = "MdB Mitarbeiter/ -innen"
Case 5021
DataList2.DataSourceID = "Sqlwkma"
DataList2.DataKeyField = "personid"
DataList2.SelectedIndex = -1
DataList2.DataBind()
DataList1.SelectedIndex = 0
DataList1.DataBind()
Label1.Text = "WK Mitarbeiter/ -innen"
Case 6000
DataList2.SelectedIndex = -1
DataList2.DataBind()
DataList2.Visible = False
Label1.Text = "keine Auswahl vorgenommen"
Case Else
Label10.Text = DropDownList1.SelectedValue
DataList2.DataSourceID = "Sqlau"
DataList2.DataKeyField = "personid"
DataList2.SelectedIndex = -1
DataList2.DataBind()
DataList1.SelectedIndex = 0
DataList1.DataBind()
Label1.Text = DropDownList1.SelectedItem.Text.ToString
End Select

"Jürgen Schulz" schrieb im Newsbeitrag
news:
Hi,
kann man eigentlich bei der Datenbindung an ein FormView zwischen 2
verschiedenen
ObjectDataSources wechseln. Wenn ja, welches wàre das geeignete Event
dafür und worauf
ist besonders zu achten?

Gruss Jürgen

Ähnliche fragen