.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
Kaviya Balasubramanian
Sgraph Infotech
Imran Ghani
Post New Web Links

Initialize background image url in css file into custom server controls

Posted By:      Posted Date: September 29, 2010    Points: 0   Category :ASP.Net
 

hi, 

i registered an image in AssemblyInfo.cs like this:


[assembly: WebResource("MyControl.Icons.bold.png", "image/png")]


.cs

protected override void RenderContents(HtmlTextWriter output)
        {
            output.Write("<p class='BoldButtons' onclick='event4()'>event4 </p>");
            
            
        }




now i want to initialize that image in css file for background-image but it dose'nt work.

my css file is:


.BoldButtons
{
	background-image: url("MyControl.Icons/font_bold.png");
    background-repeat:no-repeat;
	border: 0px; 
	height: 21px; 
	width: 21px;
}

i also try with this :


background-image: url(<%=WebResource("MyControl.Icons.bold.png")%>);

but it dose'nt work.

please help me? 







View Complete Post


More Related Resource Links

image inside custom server control

  

Hi,

I want to use an image inside a Custom Web server control ! 

Do I need to use Web.resources ? if so , how to do ?


how to make a css style background image be linked to an image in the resource file

  

hey guy, i need help in a very troubling matter. I want to make a textbox with a specific style, within this style a set of images as background parts, how can i attach these images to the custom control as whenever i take the .dll file and add it to the toolbar the images do not appear. So i tried to make them as resource files and their property as embedded in .resx file, so how to make the css style background image url to be linked to any of those image.


thanks in advance


Saving Image File in a Folder on Sever from Client Machine using Sql Server

  
  Hi EveryOne... Can anyone help me Saving an Image file in a Server folder from a client machine using Sql server 2005....   

Accessing image file in local machine from server

  
 Hi i have a  .JPG file in my local machine which has  to be sent as body of SMTP mail. Path of image D://foldername//imagename.jpg The code I run is in the server m\c. I want it to access my local machine's d:\ folder to get the image file. But it is accessing the server m\c's d:\ folder. How can this be done? Thanks Amuda.RG  

Deploy and update script file with custom ribbon tab to Sharepoint Server 2010

  

Hey everyone,

currently I'm building a custom tab for Sharepoint Server 2010 and at the moment I'm stuck on the following issue,
with the first debug deployment Visual Studio sends the .js file that provides some functions for the ribbon elements from Scripts folder in the VS project
to Sharepoint Server.
However, it won't apply any changes I did on the script afterwards to the file on the server.
So the effect is, that as soon as I do the next debug, the previous script is being used by Sharepoint and the new version, containing the new code, is left aside.

It seems to me as if Visual Studio would only deploy the .js file just once and then rely to this copy, maybe there are some configuration settings to make, but after hours of research, I still can't figure out where things do go wrong or what configuration to apply to update the script on the server.
I couldn't locate the file on hdd either, even searched the whole fs but the results showed only the new script file.

Any help on this would be very much appreciated, this issue drives me nuts and consumes plenty of time ;)

Workaround at the moment: each time the script is changed, set up new project... :D

Greets, Norman

P.S: Yes, I did flush

error in retriving image file from SQL Server

  

Hello Brother

I have a Prolem in my asp.net C# code

its a part of retriving image file from SQL Server

Hear is My Code is

first Part

Image image = RetrieveImage(id);
image.Save(Response.OutputStream, ImageFormat.Jpeg);

Second Part
    MemoryStream memStream = new MemoryStream(imageData);
    image = Image.FromStream(memStream);

My error is it asking the right assembly reference for above shown bold letter key words

 

please tell me what all are assembly reference i should add in project

please help me

thank you

Rupesh B S

 


Embedded Javascript File in Custom Server Control

  


Hi,

I am creating a custom server control, and I am wanting to include a JavaScript file in the dll file when the control is built. I have tried suggestions from the following websites:


http://weblogs.asp.net/dwahlin/archive/2007/04/29/creating-custom-asp-net-server-controls-with-embedded-javascript.aspx

http://www.infinitezest.com/articles/embedding-javascript-files-in-your-custom-controls.aspx

http://www.4guysfromrolla.com/articles/080906-1.aspx


But after following the directions, If I use firebug to see what errors show up, the JavaScript functions that are being called all say "goNext is not defined" which leads me to believe the JavaScript file is not being added correctly. 

Some information on what my control looks like

I have the JavaScript File in a folder called Script. The namespace of the project is CustomControl, and the Name of the project is MaskedDateTextbox.

In my AssemblyInfo I have the following:


Deploy and update script file with custom ribbon tab to Sharepoint Server 2010

  

Hey everyone,

currently I'm building a custom tab for Sharepoint Server 2010 and at the moment I'm stuck on the following issue,
with the first debug deployment Visual Studio sends the .js file that provides some functions for the ribbon elements from Scripts folder in the VS project
to Sharepoint Server.
However, it won't apply any changes I did on the script afterwards to the file on the server.
So the effect is, that as soon as I do the next debug, the previous script is being used by Sharepoint and the new version, containing the new code, is left aside.

It seems to me as if Visual Studio would only deploy the .js file just once and then rely to this copy, maybe there are some configuration settings to make, but after hours of research, I still can't figure out where things do go wrong or what configuration to apply to update the script on the server.
I couldn't locate the file on hdd either, even searched the whole fs but the results showed only the new script file.

Any help on this would be very much appreciated, this issue drives me nuts and consumes plenty of time ;)

Workaround at the moment: each time the script is changed, set up new project... :D

Greets, Norman

P.S: Yes, I did flush

Deploying Visual Web Part with Custom Server controls

  

I created a Visual Web Part with VizStudio 2010. In this web part I have a custom server control that exists in a project I added to the solution.

 

When I deploy from the menu can I tell Studio to deploy the Custom Library or do I install that manually?

 

It builds fine, but when I add the web part to a web part page I get an exception that the assembly cannot be found.


Adding Custom Server controls to Master Page

  

Hi All,

 

I have  developed a Custom Web server Control. Now i want that to be  added in SP2007 master page. Can any one guide me through the process?

 

I have Custom web controll dll. I added the tag prefix in master page (Now the problem is i need to specify the assembly name). How  can handle  this?

 

Regards,

Jain

 


Web Application Project and Custom Server Controls don't play together - serious bug?

  

I can't for the life of me work what the heck is going wrong with my project.  I've started using the web application project type instead of web site (which seemed a good idea until now!).  Because my project is rather large, and I can't fix the problem after spending days on it, I've created a simple blank web application project.

I will explain step by step what I am trying to do and see if you can work out what I'm doing wrong.

1) I created a blank web application project (root namespace is TestWebApp).

2) Create a new folder called 'Controls'.

3) Added a Controls.vb with a class called 'MenuTreeView' wrapped inside a namespace called 'CustomControls'.

4) Within default.aspx I have the following:

<%@ Register TagPrefix="myControls" Namespace="CustomControls"  %>


5) Now when I add <myControls:MenuTreeView> to the aspx page, it fails to see the control.  It also fails to create the definition in the .designer.vb file.

My question is why is this not working.  I've also tried several iterations of the Namespace definition e.g.

<%@ Register TagPrefix="myControls" Namespace="TestWebApp.CustomControls"  %>

Background Image In Workflow Custom Email Body

  
Hi

In my workflow I have custom email body, in my email body i want to have background image, but it seems that this tag (<td style="background-image:url()>)is not working, i can put image in my email body and it works well but background image doesn't work, Any Idea?

Thanks

Custom Controls in C# .NET

  
Embedding user controls in a Windows form is just like adding a simple button or text box that are already provided with .NET. These basic controls were written essentially like you code your own controls. Typically the controls you design are to be used in multiple forms or to modularize your code. These reasons help reduce the amount of code you have to type as well as make it easier for you to change your implementation. There should almost never be any reason to duplicate code because it leaves a lot of room for bugs. So, implementing functionality specific to your control in the control's source code is a good idea. This reduces code duplication as well as modularize your code, which is a good programming guideline.

scripts file not found on server - 404

  

Fiddler is showing a 404 error when my published web application runs. the jquery.js file in
/scripts is highlighted in red by fiddler as not found. ( IIS log also shows the 404 error ).
I run the web app from visual studio, on local host - no problems. The publish is successful.
All the files are in the scripts folder of the web app on the server.

In the site.master I have:
<script src="../../Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>

Visual studio does not complain about this. ( which indicates the file is found. )

Oddly, when I fully qualify the path, VS says file not found, but after I publish and run, fiddler
shows the jquery file being found and sent to the browser.
<script src="/MvcApplication1/Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>

when the <script> path is "../../Scripts/jquery-1.4.1.min.js", the fiddler error is
404: /Scripts/jquery-1.4.1.min.js .

when the <script> path is "/MvcApplication1/Scripts/jquery-1.4.1.min.js", fiddler shows the file
being sent to the browser from that /MvcApplication1/Scripts path.

Both the Scripts fol

video tutorial link for composite and rendered custom server control

  

hii all

i am new to technology so go easy on this post

according to what i read from web there are 3 type of custom server controls

1 superclass

2 composite

3 rendered

i found video tutorial for superclass custom server control but couldnt find video tutials for other 2.

please forward me link for composite and rendered custom server controls video tutorial  


Custom Server Control Property not maintaining state

  

I have created a server control consisting of a TextArea and a div under it.  My goal is to create my own asp:TextArea type control.  the div is for a Character count of the text area and seems to work ok but i added a CharacterCountVisible property to the control that is always returning true.  See Proptery definition below

 

<Bindable(False), Category("Appearance"), DefaultValue("True"), Localizable(True)> Property CharacterCountVisible() As Boolean
    Get
        Return _CountBoxVisible
    End Get
    Set(ByVal value As Boolean)
        _CountBoxVisible = value
    End Set
End Property

Note the _CountBoxVisible variable is define inside the class as :

Dim _CountBoxVisible as Boolean = True

What I am trying to do is give the user/coder the option to show/utilize the char count feature.  Can make it disappear with textarea1.CharacterCountVisible = False but setting it to true will not make it display.

 

What am i missing

 

Thanks

 

 


Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend