|
I've built a custom web/server-side component ComboBox. However, when I tried to explicitly
handle property assignments to the Style I get a message saying that that property may only
be set at runtime.
In my component I actually have three webcontrols: a image-button, a listbox, and a textbox,
which in my code, I use as storage for the various properties that my component supports,
including the Style properties for each of these controls using distinctive properties for
each one: ImageStyle, ListBoxStyle, and TextBoxStyle. And this works for them. Then, as I
said at the top of this message, I wanted to create an explicit property for the base
class's Style property, and got the error, so I created a new one called ComponentStyle,
and changed the Style in my component's tag from Style to ComponentStyle, but nothing shows
in the ComponentStyle property in the Designer's Property Window. Strangely, the inline
style values are getting rendered in the web-page, so they are being loaded, just not
showing in the designer.
Here is the code I'm using for my Style and ComponentStyle properties:
' --------------- Property Style --------------------------------
' Setting Browsable to False to hide this property from the Designer Property window.
' This property uses Shadow to allow me declare the Browsable directive.
<Browsable(False), Category("Component"), DefaultValue(""), _
Description("Component level inline CSS string")> _
Public Shadows ReadOnly Property [Style]() As System.Web.UI.CssStyleCollection
Get
Return MyBase.Style
End Get
End Property ' Style
' ----------- Property ComponentStyle --------------------------
' This is the public version of the above property.
'
' The Getter uses the CssStyleCollectionAsString
' function to build a string containing the
' MyBase Style settings.
'
' The Setter uses the
' ApplyCssStyleStringToCssStyleCollection function
' to set the MyBase Style setting from a string.
'
' I know that these helper functions work, I use
' them on through out my program on the other
' components, including CssStyleCollectionAsString
' in the designer to render the component's styles
' for the editor.
'
<Browsable(True), Category("Component"), DefaultValue(""), _
Description("Component level inline CSS string")> _
Public Property [ComponentStyle]() As String
Get
Return CssStyleCollectionAsString(MyBase.Style)
End Get
Set(ByVal Value As String)
ApplyCssStyleStringToCssStyleCollection(Value, MyBase.Style)
End Set
End Property ' ComponentStyle
'
' CssStyleCollectionAsString
'
' Convert a CssStyleCollection to a CSS Style Inline String.
'
' This method is also used by the designer,
' so it must be public.
'
Public Function CssStyleCollectionAsString( _
ByRef SrcCssStyleCollection As System.Web.UI.CssStyleCollection) As String
Dim SrcCssStyleCollectionCounter As Integer = SrcCssStyleCollection.Count
Dim KeyName As String
Dim KeyValue As String
Dim DestCssStyleString As String
If SrcCssStyleCollectionCounter > 0 Then
Dim Keys(SrcCssStyleCollectionCounter - 1) As String
'
' Copy the keys to a new array.
' Can't iterate on the Keys collection directly
' when the values are being changed. The code
' that makes all style names lower case isn't
' shown here, to reduce the code in this listing.
'
SrcCssStyleCollectionCounter = 0
For Each KeyName In SrcCssStyleCollection.Keys
If KeyName <> "" Then
Keys(SrcCssStyleCollectionCounter) = KeyName
SrcCssStyleCollectionCounter += 1
End If
Next
For Each KeyName In Keys
KeyValue = SrcCssStyleCollection( KeyName )
If Not KeyValue Is Nothing Then
DestCssStyleString &= KeyName & ": " & KeyValue
SrcCssStyleCollectionCounter -= 1
If SrcCssStyleCollectionCounter > 0 Then
DestCssStyleString &= "; "
End If
End If
Next
End If
Return DestCssStyleString
End Function ' End of CssStyleCollectionAsString
'
' ApplyCssStyleCollectionToCssStyleCollection
'
' Apply the CSS Style settings in one CssStyleCollection to another.
'
Public Sub ApplyCssStyleCollectionToCssStyleCollection( _
ByRef SrcCssStyleCollection As System.Web.UI.CssStyleCollection, _
ByRef DestCssStyleCollection As System.Web.UI.CssStyleCollection, _
Optional ByVal Mode As String = "REPLACE")
Dim KeyName As String
Dim KeyValue As String
Dim OldKeyValue As String
If Mode.ToUpper <> "REPLACE" Or Mode.ToUpper <> "ADD" Then
MessageBox.MessageBox("Invalid Mode, it must either be Replace or Add.",, _
"ApplyCssStyleCollectionToCssStyleCollection")
ElseIf SrcCssStyleCollection Is Nothing Then
MessageBox.MessageBox("Source CSS Style misssing",, _
"ApplyCssStyleCollectionToCssStyleCollection")
ElseIf DestCssStyleCollection Is Nothing Then
MessageBox.MessageBox("Destination CSS Style misssing",, _
"ApplyCssStyleCollectionToCssStyleCollection")
Else
If SrcCssStyleCollection.Count > 0 Then
Dim Keys(SrcCssStyleCollection.Count - 1) As String
Dim KeyCounter As Integer = 0
For Each KeyName In SrcCssStyleCollection.Keys
If KeyName <> "" Then
Keys(KeyCounter) = KeyName
KeyCounter += 1
End If
Next
If Mode.ToUpper = "REPLACE"
DestCssStyleCollection.Clear()
End If
For Each KeyName In Keys
KeyValue = SrcCssStyleCollection.Item( KeyName )
' if the key doesn't already exist, add it.
If DstCssStyleCollection(KeyName) Is Nothing Then
DestCssStyleCollection.Add(KeyName, KeyValue)
Else
DestCssStyleCollection.Item(KeyName) = KeyValue
End If
Next
End If
End If
End Sub ' End of ApplyCssStyleCollectionToCssStyleCollection
I'm using these helper functions because there aren't built in methods to convert a Style
collection to a string, via versa, and copy Style Collections to each other. Also, for some
reason you can't use the webcontrol's ApplyStyle method to copy the webcontrol's Style
setting to the MyBase.Style, which is the inherited System.Web.UI.WebControls.ListBox.
Thanks
|
|
|
|
|
A little cheeky I know, but my Momma always said "If you don't ask, you don't get".
I am going to develop a small utility which will read the files contained in the 'favourites' folder and add them to a local html page. The page will then be set as the 'home page' in a browser.
I basicaly want to have quick link menu there when I open my explorer and I'm sure a few other surfers may enjoy the benefit. But, my HTML skills are non-existent. So I would like to ask if anybody is willing to make a template file for me. As payment, I will allow the creator to include a permanent banner/link/whatever to their own page
Cheers and Beers
|
|
|
|
|
Yea sure I will help you out with a basic page template.
Send me an email at:
brad -@- trueguava.com
With a sketch of what you want.
(Please ignore Trueguava.com, it is still in development, I just made a mock home page until I get some time to finish it)
Also with the banner would you mind making it dynamic? As in I can update it depending on what I want people to go to (Don't worry I wont advertise for 3rd party stuff).
Brad
Australian
I assume Microsoft would not use doors, because using Windows is faster.
|
|
|
|
|
Thanks for the offer. I will draw up a rough template of what I am looking for, but keep in mind that I am well open to suggestions. Give me a dialog box and I will make it ergonomic, give me a webpage, I'll make a mess.
Regarding the banner, you can have it however you want. Though if it will be dynamic, it would probably have to be loaded from a third party site. But, considering this sort of banner would be uncensored in a manner of speaking, I would like to give the user the option to either disable it ( from a hard to find option ) or have it loaded from a trusted source ( ie a hard copy with the utility ).
Also, from the utilities options interface, I would like the user to be able to configure thing like "open in existing page", "open in new page" and "open in new tab" ( IE7, FF and Opera come to mind ). These options would need to be coded into the HTML ( javascript? ). I also require the page to be dispalyed correctly in all popular browsers at differing resolutions ( without scrollbars or large empty spaces ).
I will send you an email with more details about what I am looking for, and give you a better idea of how I intend to go about this.
|
|
|
|
|
WalderMort wrote:
Regarding the banner, you can have it however you want. Though if it will be dynamic, it would probably have to be loaded from a third party site. But, considering this sort of banner would be uncensored in a manner of speaking, I would like to give the user the option to either disable it ( from a hard to find option ) or have it loaded from a trusted source ( ie a hard copy with the utility ).
I will stick the banner on a personal server. Crackers would have to get past many Ciscos to change it.
WalderMort wrote: "open in new tab"
This may course some trouble, I'll see what I can find.
WalderMort wrote: javascript?
If you make it a requirement for the user to have JS enabled then I can do much better work.
Brad
Australian
I assume Microsoft would not use doors, because using Windows is faster.
|
|
|
|
|
Hi!
I have a question, if i programming with html and vbscript, these programs called "hta files" must pay licences??.
I will like what somebody tell me an free alternative to this problem, thanks.
Cuando salga el sol, no estare aqui...
|
|
|
|
|
haggenx wrote: if i programming with html and vbscript, these programs called "hta files" must pay licences?
Why do you think that?
---
b { font-weight: normal; }
|
|
|
|
|
well, because i want develop small systems in this language, but i dont know if may pay licences.
Cuando salga el sol, no estare aqui...
|
|
|
|
|
Yes, but from where did you get the idea that you should pay any licenses?
---
It's amazing to see how much work some people will go through just to avoid a little bit of work.
|
|
|
|
|
well, knowing to microsoft UFFFF!!!!, but in javascript + html too can develop hta files, i believe is major idea, thanks for yours replys
Cuando salga el sol, no estare aqui...
|
|
|
|
|
I want to output helpful messages to the user when they are input invalid vales into the various properties of the designer properties window. These will also "fire" when the properties in the component are read as the web-page containing the component is loaded into the designer editor. The problem is that when the page is rendered, the properties may "fire" off one of the messages, and this causes a page building fault indicating that I can't use the MsgBox.
To get around this I built a wrapper on MsgBox that has a "no output" flag that I can toggle on and off in my code. Then I put toggled it off at the top of the Render and CreateChildControls subroutines, but sometimes I still get the page building fault. Are there other places I can add my code to turn off my MsgBox wrapper and prevent the fault?
Also, I usually call to my MsgBox wrapper in a Try/Catch Block so that I can print out the more helpful message, but during the page building/render phase, I'd rather re-throw the exception and let that error be reported. So, is there some sort of variable or function call my code can look at to see if the page is being rendered?
|
|
|
|
|
Hello
I need to develop a tool which can search all the news about my company in web. The system will open that page and save the contents in a file.
Cany one give some idea of how i can implement this..
Is it possible to integrate any search engine in our application.
Pls help me
Kumar
Salai
|
|
|
|
|
What happened to typing your name in google?
Brad
Australian
I assume Microsoft would not use doors, because using Windows is faster.
|
|
|
|
|
How to configure FCKEditor in PHP? suggest with any example
Bharat Bhusanam
|
|
|
|
|
If you want a good PHP editor i suggest Zend Studio (somewhere Here[^]).
Best software EVER
Brad
Australian
I assume Microsoft would not use doors, because using Windows is faster.
|
|
|
|
|
Sir,
I wanted to know the basic difference between vbscript and javascript.
Thanks
|
|
|
|
|
amaneet wrote: I wanted to know the basic difference between vbscript and javascript.
I don't see exactly how this is a problem.. but...
JavaScript is the widely accepted web scripting language. Functionality aside, the main reason you do not use VBscript is because it is only supported by internet explorer.
JavaScript is a better choice in 99% of cases.
Brad
Australian
I assume Microsoft would not use doors, because using Windows is faster.
|
|
|
|
|
Hi
There is no basic differece between these two.But mostly JavaScript is used over internet technolgies..
The Difference is that VBScript is a Microsoft Product so it may not be run
on any other platform like Linux...
But JavaScript runs on Linux.
2nd Thing is that JAVAScript is open Standard so it supports many other web langauages like asp,asp.net ,PHP etc...
while VBScript may not be supported by other opensource langugaes..
The above differences are as per my knowledge and may also be wrong according to other genios progrmmers...
i want to make you friend..you want my friendship?
Regards
Nilesh P. Upadhyay
India.
|
|
|
|
|
Sorry to nit pick...
NileshUpadhyay wrote: The Difference is that VBScript is a Microsoft Product so it may not be run
on any other platform like Linux...
But JavaScript runs on Linux.
It is not a case of the platform, but rather the browser. It really comes down to the fact that vb script runs on IE only.
NileshUpadhyay wrote: 2nd Thing is that JAVAScript is open Standard so it supports many other web langauages like asp,asp.net ,PHP etc...
while VBScript may not be supported by other opensource langugaes.
JavaScript and VBscript do not have too many programming interfaces when it comes down to other languages. Because they are both browser languages there are few other languages they can interface with. Interface with server side languages will always take place using the HTTP protocol. However this does raise the point that JavaScript can interface with Flash very easily.
Brad
Australian
I assume Microsoft would not use doors, because using Windows is faster.
|
|
|
|
|
sir/Madam
Can I please put the HTML question in this form.
The question is <input id = "button" type = "button"> .
After clicking the browse button .I get the option to select the file.Now the problem is I want to do the code after clicking the open button (after selecting the file)
Thanks
|
|
|
|
|
amaneet wrote: sir/Madam
Please, call me Mr Emell.
amaneet wrote: The question is .
After clicking the browse button .I get the option to select the file.Now the problem is I want to do the code after clicking the open button (after selecting the file)
I am afraid I don't understand your question.
What are you trying to accomplish?
Brad
Australian
I assume Microsoft would not use doors, because using Windows is faster.
|
|
|
|
|
Mr Emell,
The problem is On selectiong the file usinf the help of input tag for button i want to show the selected file it in the img control.Presently , With the help of another button I am first picking the path from input file type tag .The displaying it in the img control.
I want to accomplish it with using extra button.I mean after selcting the file and clicking the open button of browse i want to diaplay the same.
Please help.
|
|
|
|
|
amaneet wrote: Mr Emell,
The whole Mr Emell thing was a joke, Brad is fine.
Anyway I have interpreted your predicament as not being able to display an image that was selected from a file using the file input type.
From what I can remember you cannot access the user's local machine through script. A way to implement this system is to have the image uploaded to your server and then have the page call it through JavaScript.
Brad
Australian
I assume Microsoft would not use doors, because using Windows is faster.
|
|
|
|
|
Hi All
I am new to ASP, i have a web application through which user uploads a zip file to the web server.I need to display to the client(who is uploading the zip file)the path of the files and file name, in the zip file in a list box on the same page
i.e Let say user have a file ABC.zip with its content as
File Name Path
a.cpp 123\456\a.cpp
b.gif 123\456\a.cpp
This infomation i want to display to user either at time he selects the file (using browse option) or if that is not possible then after uploading to webserver.
Looking forwards to a positive response
Thanks
Ashish
|
|
|
|
|
Ashish,
For ASP, you need a component like XCeed etc. If you have ASP.NET, you can use XCeed for .NET or SharpZipLib or Java.Util.Zip (from Visual J# runtime vjslib.dll)
|
|
|
|
|