U
Ugur Ekinci
Hi ,
I load dynamically a user control in PlaceHolder with the number of fileds
in db.
When loading user control there is no problem, if returning field number is
2 then 2 usr controls load in plcholder.
But problem is that , after page postback plcholder says that I have no
control,
For i As Integer = 0 To plcHolderUsrCont.Controls.Count - 1
kontrol1 = DirectCast(plcHolderUsrCont.Controls(i),
UrunGrupTeknik)
Dim a As String = kontrol1.txtvalue
Next
I added a reference like below , because usr control loading dynamically
<%@ Reference Control = "../kontroller/UrunGrupTeknik.ascx" %>
I defined a protected variable that's type is my usr control
Protected urunGrupTeknikTxtLbl As UrunGrupTeknik = New UrunGrupTeknik
and I load user control like that..
For i As Integer = 0 To tdsTeknikDetay.table1.Rows.Count - 1
thisrowTeknikDetay = tdsTeknikDetay.table1.Rows(i)
findControlPath = Request.ApplicationPath +
"/kontroller/UrunGrupTeknik.ascx"
kontrol1 = Me.LoadControl(findControlPath)
urunGrupTeknikTxtLbl = DirectCast(kontrol1, UrunGrupTeknik)
urunGrupTeknikTxtLbl.lblValue = thisrowTeknikDetay.ACIKLAMA
kontrol1.ID = i
plcHolderUsrCont.Controls.Add(kontrol1)
Next
plcHolder.controls.Count is set to 0 after postback(
Have you any idea about this problem ?
Thnks....
I load dynamically a user control in PlaceHolder with the number of fileds
in db.
When loading user control there is no problem, if returning field number is
2 then 2 usr controls load in plcholder.
But problem is that , after page postback plcholder says that I have no
control,
For i As Integer = 0 To plcHolderUsrCont.Controls.Count - 1
kontrol1 = DirectCast(plcHolderUsrCont.Controls(i),
UrunGrupTeknik)
Dim a As String = kontrol1.txtvalue
Next
I added a reference like below , because usr control loading dynamically
<%@ Reference Control = "../kontroller/UrunGrupTeknik.ascx" %>
I defined a protected variable that's type is my usr control
Protected urunGrupTeknikTxtLbl As UrunGrupTeknik = New UrunGrupTeknik
and I load user control like that..
For i As Integer = 0 To tdsTeknikDetay.table1.Rows.Count - 1
thisrowTeknikDetay = tdsTeknikDetay.table1.Rows(i)
findControlPath = Request.ApplicationPath +
"/kontroller/UrunGrupTeknik.ascx"
kontrol1 = Me.LoadControl(findControlPath)
urunGrupTeknikTxtLbl = DirectCast(kontrol1, UrunGrupTeknik)
urunGrupTeknikTxtLbl.lblValue = thisrowTeknikDetay.ACIKLAMA
kontrol1.ID = i
plcHolderUsrCont.Controls.Add(kontrol1)
Next
plcHolder.controls.Count is set to 0 after postback(
Have you any idea about this problem ?
Thnks....