|
Frankidoze wrote: Setting the ImageUrl property of the Image with "~/Images/myImage.gif" doesn't work.
That should work.
What do you mean when you say that it "doesn't work"? What does it do, and how does that differ from what you expect? Do you get any error message?
Experience is the sum of all the mistakes you have done.
|
|
|
|
|
It doesn't work because the image is not loaded when I run the page.
There is no error. It shows the traditional "image missing" image .
The situation is this:
My custom control MyCC is a class (it's not a user control) compiled into a dll.
All images I need to use for MyCC are defined in a folder named Images. So I guess they ended up in the dll somehow.
My page uses MyCC.
When MyCC is rendered, the image set for the Image control is not found because their is no such file on my web server.
In order to access those images from the page I guess they need to be extracted from the dll.
I want to defined those images with my class so wherever you use the control no extra step need to be done. Just drag the CC from the tool bar onto your page.
I guess at some point I need to manage those images as resources.
I hope my explanations will help you to help me.
"Nothing is lost, Nothing is created, Everything is transformed" Lavoisier
|
|
|
|
|
"Nothing is lost, Nothing is created, Everything is transformed" Lavoisier
|
|
|
|
|
Here is the solution to
How to dynamically load images within a custom control with images embedded with it!
Context:
You have a project of type "Class Library" where you create your custom control MyCC.
1/ Add a new item: Resources File: Resources.resx
2/ Drag your images onto this resource file you had open. This will generate a sub folder named Resources containing all images dragged.
3/ Under "Solution Explorer", select each image file to change their "Build Action" property to "Embedded Resource".
4/ Set the image url property as follow in the overrided Render() or RenderControl() method depending which one you are using to generate the HTML of your custom control:
this._myImage.ImageUrl = Page.ClientScript.GetWebResourceUrl(this.GetType(), "MyNameSpace.Resources.MyImage.gif");
The second param is of structure: [Namespace].[Resources Folder].[Resource File Name]
5/!!!! Carefull, the Namespace above and below has to match the default one defined in the project properties (Tab "Application").
6/ Last, either in your custom control .cs file or in your AssemblyInfo.cs, add this line for each image:
[assembly: System.Web.UI.WebResource("MyNameSpace.Resources.MyImage.gif", "image/gif")]
Conclusion:
Like this any page using your custom control will be able to display any image declared in your custom control.
Note: If you look at your page source when you run it, the src attribute of your image uses a WebResource.axd.
Enjoy.
If I have missed anything, I apologize.
"Nothing is lost, Nothing is created, Everything is transformed" Lavoisier
|
|
|
|
|
I need to create an application that reads a users current token id and if the token id is successful, I need to redirect them to their account home page.
What is this token id and how do I go about reading it?
Thanks.
-Goalie35
|
|
|
|
|
We have purchased a new webserver in which we installed the 2.0 framework and iis. I have developed an application which I am trying to deploy to this server. I created a new application pool for my 2.0 apps to run in. I created a new website in IIS and configured the settings accordingly, however I am receiving "A Page Not Found" error whenever I try to visit the site url. I have type in the specific file location for an html file in the site directory and was able to pull that page. However, when I try and reference the default.aspx page or any other .aspx pages, I receive the same error. As a result I went in to the documents portion of the website and made sure that default.aspx was added among the listed documents. To no avail, I still received the same error. Can anyone provide any light on this or let me know if there is some configuration on the site that i have missed? Thanks in advance.
|
|
|
|
|
Try
#1. Create the HTML file named default.htm in your webpage. and try to call and see whether you are still getting "Page Not Found" error..
#2. Add "default.aspx" in "Default Document" in IIS and restart the IIS or (maybe.. machine too. :-> )... and see whether this issue is solved or not..
|
|
|
|
|
Hi Michael,
I tried the suggested and it still is not calling the .aspx pages. Any other suggestions?
|
|
|
|
|
Have you tried #1? "#1. Create the HTML file named default.htm in your webpage. and try to call and see whether you are still getting "Page Not Found" error.. "
Can you see the html page without calling explicitly???
|
|
|
|
|
I tried #1 and was able to pull the default page without explicitly calling it. When I move the default.aspx first on the document listing i then get the error (even calling it explicitly).
|
|
|
|
|
Found the solution to my problem...Go to this link
http://imar.spaanjaars.com/QuickDocId.aspx?QUICKDOC=254
|
|
|
|
|
oh. man.. i thought you have configured it already... okay.. thanks for the link..
|
|
|
|
|
Hi,
I am working on a ASP.Net page in which I need to display ALERTS available for a user, and the user can subscribe to what ALERTS he can get. I have a Subscriptions table in the database which has the ALERTS and CATEGORY.
I need to show the categories and alerts for each category and show check boxes for the user to select which alerts he/she wants to subscribe to.
I know I could create the controls on run time but would want to use a better technique.
Thanks,
Sandeep
|
|
|
|
|
Sandeep3678 wrote:
I know I could create the controls on run time but would want to use a better technique.
What about using GridView with Checkedbox column?
|
|
|
|
|
yes thats what im thinking but I need grouping here by category. Any best way to do it?
|
|
|
|
|
then, you will need the control that can work like treeview + gridview... or you can use two gridviews for that.. one for category and one for subscription... you can show the list of categories with hyperlink in gridview at the top.. if the user clicks on a particular category, you can show the list of related information with checked boxes.. but it won't be look nice.. it is better if you have a control that can use like TV + GV..
|
|
|
|
|
Or I could have a bound column for category and template column with Check box for subscription and group the gridview right? This seems to be a very viable option right now. Could you guide me through it?
|
|
|
|
|
Check this for grouping row in Gridview..
http://blog.zygonia.net/PermaLink,guid,c093836d-8d97-4e5b-8a1c-8218742cb686.aspx\
Check-out this for manipulating with chked boxes in GridView..
http://www.codeproject.com/aspnet/SelChkboxesDataGridView.asp
|
|
|
|
|
Hello. I'm working with a Custom Membership Provider and a login control. In Internet Explorer the Login Button of the Login Control does not work(it does not submit the page). The page has a master page. Somebody knows why?
-- modified at 10:43 Wednesday 7th November, 2007
|
|
|
|
|
I have a Listbox in an Ajax UpdatePanel, when the user clicks the submit button and navigates away from the page, I clear the data using ListBox.Items.Clear(); However, when the user clicks the back button in the browser the data is still in the ListBox.Items collection.. (Its invisible at first, but when you try and add a new item to the listbox, the old items show up again). *shrug* anyone ever had this problem?
|
|
|
|
|
Hi all,
Iam using the following code to send email attachments
<br />
HttpContext.Current.Response.Charset = ""<br />
Dim tw As New System.IO.StringWriter<br />
Dim hw As New System.Web.UI.HtmlTextWriter(tw)<br />
report.RenderControl(hw)<br />
'My.Computer.FileSystem.DeleteFile(HttpContext.Current.Server.MapPath("~\Attachments\" & ReportName))<br />
<br />
Dim attachment As String = HttpContext.Current.Server.MapPath("~\Attachments\" & ReportName)<br />
<br />
My.Computer.FileSystem.WriteAllText(attachment, tw.ToString, False)<br />
AppEmailService.SendMail(subject, body, attachment, receiver)<br />
tw.Close()<br />
hw.Close()<br />
tw = Nothing<br />
hw = Nothing
the first time any user sends an email, it is successfully sent. If i try to send the same attachment again, it is giving me an error that the attachment is being in use.
"The process cannot access the file 'c:\inetpub\wwwroot\ORM\Attachments\Number of operational Loss Events.xls' because it is being used by another process"
Any ideas
|
|
|
|
|
this is my stored procedure in oracle, am using oracle client,
cmd.parameter.add() to RETURN the value of the parameter but its not working.
PROCEDURE "SCOTT"."PROCEDURE2" (
"PARAM1" IN NUMBER, "PARAM2" out VARCHAR2) IS
varEname VARCHAR2(40):='xxx';
varComm REAL;
varSalary CONSTANT NUMBER:=1000;
comm_missing EXCEPTION;
BEGIN
SELECT ENAME,
COMM
INTO varEname,
varComm
FROM EMP
WHERE EMPNO = param1 ;---7369;
IF varComm IS NULL THEN
RAISE comm_missing;
else
dbms_output.put_line('Commision is ' || varcomm );
END IF;
param2:=varEname;
dbms_output.put_line(param2);
EXCEPTION WHEN comm_missing THEN
dbms_output.put_line('Commision is NULL');
WHEN no_data_found THEN
dbms_output.put_line('Employee Does not Exist');
END "PROCEDURE2";
I need to retrieve the value of param2 inside my Asp.net code.
Please help me with Ideas.
Salami
|
|
|
|
|
check out this link ..hope it will help u...
http://aspnet.4guysfromrolla.com/articles/062905-1.aspx
regards
Ramesh
|
|
|
|
|
How can I use a connection string stored in the web.config file to get a datatable from the sql server 2005 ?
thx in advance.
BiG RaLpH
|
|
|
|
|
Hi.
Your connection string of course might be different but here's what you do with that. Put the following inside <configuration></configuration> right after let's say </system.web> (Make sure it doesnt go inside system.web node)
<appSettings>
<add key="SQLConString" value="packet size=4096;data source=SERVER;persist security info=True;user id=USERUD;password=PASSWORD;initial catalog=DATABASE"/>
</appSettings>
In your code do the following to get connection:
Dim sConn As String<br />
sConn = ConfigurationSettings.AppSettings("SQLConString")<br />
Dim con As New System.Data.SqlClient.SqlConnection(sConn)<br />
con.Open()<br />
....<br />
....<br />
....<br />
con.Close()
That's it.
-- modified at 9:20 Wednesday 7th November, 2007
|
|
|
|