Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > retrieve value from control

Reply
Thread Tools

retrieve value from control

 
 
David J Duryea
Guest
Posts: n/a
 
      01-27-2004
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



 
Reply With Quote
 
 
 
 
Alessandro Zifiglio
Guest
Posts: n/a
 
      01-27-2004
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$ t...
> 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
>
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Retrieve a Value from the DataGrid Control Samuel Shulman ASP .Net 1 11-14-2006 06:52 AM
How to retrieve control's value from ViewState epigram ASP .Net 2 06-03-2005 06:18 PM
How to retrieve control's value from ViewState epigram ASP .Net 0 06-03-2005 12:42 PM
VB Newbie, Retrieve Listbox value from Control David J Duryea ASP .Net 1 01-27-2004 10:59 AM
How do I retrieve / request a Windows.Form.Control's Value running on a WebForm ? Softwaremaker ASP .Net 2 10-27-2003 02:47 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57