473,388 Members | 1,417 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

[ASCX] Add an ascx in a webcontrol...

hey there,

ok i made a class, that inherits webcontrol, and i add an htmltable to it. I
was wondering how to declare an ascx file as an object in my class, like
that i could change the content (the ascx file) of a cell thanks to a
property and it would be great :)

Merci d'avance pour l'aide :)
Nov 17 '05 #1
1 3148
thank you for your response :)

But i'm not sure i explained my problem well... I made a class in an other
file than the aspx one. This class is juste an HtmlTable, it looks like a
window, and i'd like to add a property to this class as to add an ascx in a
cell. My english is not so good so let me give you an example.

--------MesClasses.vb-----------------------

Public Class MaFenetre : inherits WebControl

Public Sub New()
Dim Fenetre As New HtmlTable
Dim MaLigne As New HtmlTableRow
Dim MaCellule As New HtmlTableCell
Dim MyObjectAscx As ?????

MaCellule.Controls.Add(MyObjectAscx)

MaLigne.Cells.Add(MaCellule)

Fenetre.Rows.Add(MaLigne)

Fenetre.Width = "100%"
Fenetre.height = "100%"

Me.Controls.Add(Fenetre)
End Sub

Public Property InnerPage As String
Get
Return InnerPage
End Get
Set(ByVal Value As String)
InnerPage = Value
MyObjectAscx.Path = InnerPage
End Set
End Property

End Class

Where InnerPage is the path of the *.ascx file. But the thing i don't know
is how to declare the future object that will be the ascx file in my
class...

Thank you for your help.

"Swanand Mokashi" <sw*****@swanandmokashi.com> a écrit dans le message de
news: OV**************@TK2MSFTNGP10.phx.gbl...
say your custom control is called Menu

Add this to the aspx page , to which you want to add the web control
<%@ Register TagPrefix="Anything" TagName="Menu" SRC="Menu.ascx"%>

now in the page
<Anything:Menu runat="server" id="Menu1"/>

now in page behind
Page.FindControl("Menu1").WhateverPropertyMethod
HTH
--
Swanand Mokashi
Microsoft Certified Professional
http://www.swanandmokashi.com/
Home of the Stock Quotes, Quote of the day and Horoscope web services
"Quentin" <Qu****************@wanadoo.Fr> wrote in message
news:uj**************@TK2MSFTNGP12.phx.gbl...
hey there,

ok i made a class, that inherits webcontrol, and i add an htmltable to
it. I
was wondering how to declare an ascx file as an object in my class, like
that i could change the content (the ascx file) of a cell thanks to a
property and it would be great :)

Merci d'avance pour l'aide :)


Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Owatona | last post by:
Hi to all... I have 3 classes derived from webcontrol. I the first i have two dropdownlist, in the second i have some buttons, and the third its the webcontrol that are instanciate the two...
0
by: Quentin | last post by:
I made a class in an other file than the aspx one. This class is juste an HtmlTable, it looks like a window, and i'd like to add a property to this class as to add an ascx in a cell. My english is...
6
by: Quentin | last post by:
I need to import an *;ascx, as an object, in my class, that is in myclass.vb. How can i do ? i saw the method LoadControl but i can't use it, or maybe i did wrong, if could help me it would be very...
2
by: Quentin | last post by:
Hello, I got a Solution, containing two projects, a project of classes, and a web project. The two projects directories are not located in the same place (directory ?). Into my project of...
4
by: Rob Meade | last post by:
Hi all, I have just put together our organisations 'template' for our web applications and have created 7 .ascx files which when dropped into my template file work perfectly...however, I have a...
1
by: Brent Burkart | last post by:
Can anyone shed light on this situation. I have dropdownlists that won't fire when I select an item when there is a webcontrol on the page. When I remove all the webcontrols, the dropdownlist...
1
by: Maersa | last post by:
Hi all, i've got a control that has a button and when clicked on it would send a postback, all of this works fine when the control is placed on a webform (aspx) but doesn't work when placing it...
9
by: kw | last post by:
What is the proper way to get the element ID for a client script? For example, suppose in the WebControl: TextBox t=new TextBox; t.ID=this.ClientID+"X"; .... Then elsewhere we want to access...
3
by: Sabri AKIN | last post by:
Hi, I want to send ascx file's html code as email.this ascx file is summary of customer sale.and at last iwant to send email to customer.how can i get and past ascx file's html code to mail body.
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.