retrieve value from control

Discussion in 'ASP .Net Web Controls' started by David J Duryea, Jan 27, 2004.

  1. Please if anyone can help, it would be greatly appreciated


    I have a VB form on a page called create.aspx with some text fields and
    listboxes.
    I also have a control on the form

    <%@ Register TagPrefix="UserControl" TagName="Categories"
    Src="/Categories.ascx" %>

    The Control Categories.ascx contains 2 listboxes CatID and SubCatID

    The create.aspx page posts its values to a stored Proc. However I cannon
    obtain the vaules from the listboxes on Categories.ascx.

    I have tried
    Request.Form("CatID")
    CatID.SelectedItems.Value

    If anyone can help I would appreciate it.

    Thanks in advance.

    Dave
     
    David J Duryea, Jan 27, 2004
    #1
    1. Advertising

  2. hi dave, here is a quick copy and paste from the docs ;P

    To set a property of a user control in a Web Forms page

    Select the user control file in Solution Explorer and drag it onto your
    page. Note the ID of the user control displayed in the page.
    Press F7 to switch from Design view to the code-behind file.
    In the Declarations area, add a line to declare the user control. For
    example, for a user control of type WebUserControl1 whose ID is myControl1:
    ' Visual Basic
    Public Class MyPage
    Inherits System.Web.UI.Page
    Protected myControl1 As WebUserControl1

    // C#
    public class MyPage : System.Web.UI.Page
    {
    protected WebUserControl1 myControl1;
    Note The ID in the code-behind declaration must exactly match the ID for
    the user control in Design view.
    Now that you have a code declaration for the user control, all of the public
    properties, methods, and events of your user control are available, and will
    appear in the IntelliSense statement completion dropdowns.

    Write code to call methods or set properties of your user control. For
    example:
    ' Visual Basic
    myControl1.Visible = True
    myControl1.DataBind()

    // C#
    myControl1.Visible = true;
    myControl1.DataBind();

    "David J Duryea" <> wrote in message
    news:dUjRb.9975$...
    > Please if anyone can help, it would be greatly appreciated
    >
    >
    > I have a VB form on a page called create.aspx with some text fields and
    > listboxes.
    > I also have a control on the form
    >
    > <%@ Register TagPrefix="UserControl" TagName="Categories"
    > Src="/Categories.ascx" %>
    >
    > The Control Categories.ascx contains 2 listboxes CatID and SubCatID
    >
    > The create.aspx page posts its values to a stored Proc. However I cannon
    > obtain the vaules from the listboxes on Categories.ascx.
    >
    > I have tried
    > Request.Form("CatID")
    > CatID.SelectedItems.Value
    >
    > If anyone can help I would appreciate it.
    >
    > Thanks in advance.
    >
    > Dave
    >
    >
    >
     
    Alessandro Zifiglio, Jan 27, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Softwaremaker
    Replies:
    2
    Views:
    506
    Rajesh.V
    Oct 27, 2003
  2. David J Duryea

    VB Newbie, Retrieve Listbox value from Control

    David J Duryea, Jan 27, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    1,507
    Natty Gur
    Jan 27, 2004
  3. epigram
    Replies:
    2
    Views:
    7,837
    epigram
    Jun 3, 2005
  4. epigram
    Replies:
    0
    Views:
    401
    epigram
    Jun 3, 2005
  5. Samuel Shulman

    Retrieve a Value from the DataGrid Control

    Samuel Shulman, Nov 11, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    297
    Shahzad Godil
    Nov 14, 2006
Loading...

Share This Page