Ahoj,
narazil jsem na problem a potreboval bych radu,
mam website, asp.net 4.6, webforms,
na page vkladam pri form.init controly, ty se vlozi a vse funguje jak ma, ale vkladam i placeholder, do ktereho jeste po vlozeni vsech controlu potrebuju vlozit controly z db a tu je problem.
kod je:
Dim NewControl As New PlaceHolder
NewControl.ID = Params(4)
Response.Write("before_form:" & form1.Controls.Count & " ")
form1.Controls.Add(NewControl)
Response.Write("after_form:" & form1.Controls.Count & " ")
Response.Write(form1.ID & " - " & NewControl.ID)
Response.Write("<br/>")
vysledek je: before_form:16 after_form:17 form1 - Center, takze tady to vypada dobry
nasledne se pokousim o:
Dim Control As Control = LoadControl("/" & i.Type & ".ascx")
Dim nControl As IObjectsInterface = CType(Control, IObjectsInterface)
nControl.ID = i.ID
Dim Dynamic As New Control
Response.Write("before_center:" & Dynamic.Controls.Count & " ")
Dynamic.FindControl("Center")
Dynamic.Controls.Add(Control)
Response.Write("after_center:" & Dynamic.Controls.Count & " ")
Response.Write(Dynamic.ID & " - " & Control.ID)
Response.Write("<br/>")
vysledek je: before_dynamic:0 after_dynamic:1 -, tady uz to dobry neni, neco se pridalo, ale dynamic, ani control nemaji ID
napada vas prosim, co delam spatne?
Roman