Capturing Server Controls Data FindControl

  •  02-26-2005, 7:57 AM

    Capturing Server Controls Data FindControl

    How do you capture a Dropdown or Textbox selectedValue or text when it's dynamically added to the editor. I'm getting a "Invalid specified Cast" or "Object Reference to Nothing" when I use rcpReditor.findcontrol("ddlcat"). The add code is below and the get.

    'Add dropdown and bind it to datasource 

    Dim ddlCat AsNew System.Web.UI.WebControls.DropDownList

    ddlCat.ID = "ddlCat"

    ddlCat.DataSource = dt

    ddlCat.DataTextField = "CategoryTitle"

    ddlCat.DataValueField = "CategoryID"

    ddlCat.DataBind()

    rcpEditor.AddToolbarGroupStart()

    rcpEditor.AddToolControl("ddlCat", ddlCat)

    rcpEditor.AddToolbarGroupEnd()
     
    'Retrieve data on Postback

    PrivateSub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    Dim i AsInteger

    For i = 0 To rcpEditor.ToolControls.Count - 1

    ddlCat = rcpEditor.ToolControls("ddlcat").Control

    Next
    EndSub
     
    'Produces error
     
     
    thanks,
     
    MU
View Complete Thread