473,672 Members | 2,754 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Custom control help

Hi,

Can anyone help me to build custom control for the following

<HEAD>
<LINK href="~/Styles/Blah.css" rel="stylesheet " type="text/css">
<meta name="GENERATOR " Content="Micros oft Visual Studio .NET 7.1">
<meta name="CODE_LANG UAGE" Content="C#">
<meta name="vs_defaul tClientScript" content="JavaSc ript">
<meta name="vs_target Schema" content =
"http://schemas.microso ft.com/intellisense/ie5">
</HEAD>

to

<FW:Head id="myHead1" Style="~/Styles/Blah.css" Keyword="Blah"
runat="server"/>

I would apperiate any help i can get.

Regards,
RajSurisetti.
Nov 18 '05 #1
3 1573
ra***********@a eromech.usyd.ed u.au (RajSurisetti) wrote in message news:<48******* *************** ****@posting.go ogle.com>...
Hi,

Can anyone help me to build custom control for the following

<HEAD>
<LINK href="~/Styles/Blah.css" rel="stylesheet " type="text/css">
<meta name="GENERATOR " Content="Micros oft Visual Studio .NET 7.1">
<meta name="CODE_LANG UAGE" Content="C#">
<meta name="vs_defaul tClientScript" content="JavaSc ript">
<meta name="vs_target Schema" content =
"http://schemas.microso ft.com/intellisense/ie5">
</HEAD>

to

<FW:Head id="myHead1" Style="~/Styles/Blah.css" Keyword="Blah"
runat="server"/>

I would apperiate any help i can get.

Regards,
RajSurisetti.


This is code

using System;
using System.Componen tModel;
using System.Web.UI;

namespace myNameSpace{
[
DefaultProperty ("Stylesheet ")
]
/// <remarks>
/// Creates a Head element in HTML with the appropriate attributes as
required by the framework.
/// </remarks>
public class Head : Control, INamingContaine r
{
[
Category("Behav ior"),
DefaultValue("" ),
Description("Th e html head tag generator for the framework")
]
#region Internal Properties
private String sKeywords = "";
private String sStylesheet = "";
#endregion
#region Properties
public String Keywords
{
get
{
return sKeywords;
}
set
{
sKeywords = value;
}
}

public String Stylesheet
{
get
{
return sStylesheet;
}
set
{
sStylesheet = value;
}
}
#endregion
#region Overrides
// This ensures that there are no child controls.
protected override ControlCollecti on CreateControlCo llection()
{
return new EmptyControlCol lection(this);
}
protected override void Render(HtmlText Writer writer)
{
writer.RenderBe ginTag(HtmlText WriterTag.Head) ;
if(sStylesheet. Length != 0)
{
writer.AddAttri bute( "rel", "stylesheet ", false);
writer.AddAttri bute( "type", "text/css", false);
writer.AddAttri bute( "href", sStylesheet, true);
writer.RenderBe ginTag(HtmlText WriterTag.Link) ;
writer.RenderEn dTag();
}
if(sKeywords.Le ngth != 0)
{
writer.AddAttri bute( "name", "keywords", false);
writer.AddAttri bute( "content", sKeywords, true);
writer.RenderBe ginTag(HtmlText WriterTag.Meta) ;
writer.RenderEn dTag();
}
writer.RenderEn dTag();
}
#endregion
}
}
cheers,
RajSurisetti
Nov 18 '05 #2
Hello ra***********@a eromech.usyd.ed u.au,

If I'm not mistaken, this code will write out in this format...

<html>
<body>
<head>...</head>
</body>
</html>

instead of the expected format where <head>...</head> would be a child of <html>.

--
Matt Berther
http://www.mattberther.com
Nov 18 '05 #3
Matt Berther <mb******@hotma il.com> wrote in message news:<#$******* *******@TK2MSFT NGP11.phx.gbl>. ..
Hello ra***********@a eromech.usyd.ed u.au,

If I'm not mistaken, this code will write out in this format...

<html>
<body>
<head>...</head>
</body>
</html>

instead of the expected format where <head>...</head> would be a child of <html>.


Hi Matt,

<FW:Head id="myHead1" Style="~/Styles/Blah.css" Keyword="Blah"
runat="server"/>

Generated HTML code

<HEAD>
<LINK href="~/Styles/Blah.css" rel="stylesheet " type="text/css">
<meta name="Keyword" Content="Blah">
</HEAD>

you can add as many meta tags you want.
I used same logic for Breadcrumbs and it worked fine.

----------------------
Hope this is helpful.
RajSurisetti.
Nov 18 '05 #4

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

Similar topics

8
3181
by: Tinus | last post by:
Hello all, I've create a custom control (UserControl) and have a custom Item Collection. The control is a custom calendar which is draw using the Graphics Rectangle etc. functions. It is drawn when the control is painted or resized. When the control is drawn it draws also the items found in the collection. So far so good.... I have 3 questions which I'm unable to find a solution
15
10938
by: Tinus | last post by:
Hello all, I've created a custom control that draws a monthly schedule (using the Draw function in C#). Basically it draws 31 boxes and writes the day number in every box. This works great. But I now want to show a different tooltip for every day. For now I found out that I can add a tooltip for the entire custom control
21
2093
by: One Handed Man \( OHM - Terry Burns \) | last post by:
When using a custom control. In order to check and see if values have changed one has to implement the IPostBackDataCollection interface. The values returned for the control seem to be simply a string with comma delimited values. For example, if I were to render two text boxes. One with the Value Terry and the Other with the Value 'Burns' I would get the following value Terry,Burns.
7
2990
by: Shimon Sim | last post by:
I have a custom composite control I have following property
2
2579
by: Suzanne | last post by:
Hi all, I'm reposting this message as I'm experiencing this problem more and more frequently : I really hope someone out there can help me as I've been tearing my hair out on this one for a good while and I'm getting really frustrated now! My problem is this - my custom controls periodically disappear from my
19
4909
by: Jamey Shuemaker | last post by:
I'm in the process of expanding my knowledge and use of Class Modules. I've perused MSDN and this and other sites, and I'm pretty comfortable with my understanding of Class Modules with the exception of custom Collection Classes. Background: I'm developing an A2K .mdb to be deployed as an .mde at my current job-site. It has several custom controls which utilize custom classes to wrap built-in controls, and add additional functionality....
5
2340
by: Alan Silver | last post by:
Hello, I have a products page that takes a product ID in the query string. Based on the product details (from a database), the page then loads up one of a number of custom controls, calls a method in the control (that displays product info) and then loads the control into a placeholder so it will be displayed. I want to be able to restore the state of the controls in the custom control, but can't get it to work. For example, the...
15
6506
by: rizwanahmed24 | last post by:
Hello i have made a custom control. i have placed a panel on it. I want this panel to behave just like the normal panel. The problem i was having is that the panel on my custom control doesnt accept other controls. The control i drag drop on it becomes the child of my custom control's parent form and not the child of my custom control. Then i added this line "" before my custom control class (i dont know what this line does). Now
2
3251
by: ahmed.maryam | last post by:
Hello Everyone, I designed a custom control that is entirely covered by a picture box. I then dragged this custom control onto a windows form application (called main) and I need to handle mouse events in my main application. Specifically, when a user double clicks on my custom control I need to draw something on another picture box located in my main application. I'm going to attempt to draw the scenario because I think it will
0
8504
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8946
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8849
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8644
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8697
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6260
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4243
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2841
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2094
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.