[RESOLVED] unable to display image dynamicallly

I am trying to change my logo dynamically but its not displaying from client side, its working only in the server

 

My Code

StringBuilder sbilder = new StringBuilder();
                    sbilder.AppendLine("function ChangeLogo(){");
                    sbilder.AppendLine("document.getElementById('logo').style.background = 'url(" + NewLogo + ") no-repeat';"); //NewLogo="D:\UserName\logo.jpg"
                    sbilder.AppendLine("document.getElementById('logo').style.width='304px';");
                    sbilder.AppendLine("}");
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "ChangeLogo", sbilder.ToString(), true);
                    Page.RegisterStartupScript("ChangeLogo", "<script language='javascript'>ChangeLogo();</script>");

Hi,

pathipati

its not displaying from client side, its working only in the server

Indeed, and the reason is simple, you're making use of a path format which should not be used: D:\UserName\logo.jpg.

Include the logo in your application, likely under the Images subfolder (create one if you don't have it or put it somewhere else) and then add some code like:

string NewLogo = this.ResolveUrl("~/Images/logo.jpg");

Grz, Kris.

Thank you for your support!!

In  my case i want to display images from out side of the application.

pathipati

i want to display images from out side of the application.

Then simply expose the url of these like http://www.somecoolurl.com/images/logo.jpg and make use of these. You can't make use of a hardware path but you need to provide a uri so that a browser can actually get the image.

If you don't want to do it like that and you have access from the server from which your application runs then you can also make use of a custom written HttpHandler which grabs the file and streams it to the browser in an <img> element.

Grz, Kris.

[RESOLVED] Dynamically adding rows and cells to the table.....

Hi,

I have a Table control, where I add controls to a new the cell, add this new cell to a new row and add this new row to the table.

Page renders fine. How can I have viewstate so that I don't have to call sql server again, get all the values, create new cells, rows and then add to the table?

How can I retain what has been added to the table, instead of re-creating the table all over again evertime there is a postback.

Thnx

 

Hi,

You must recreate the table in each postback, because the table content is created in each postback, then the table haves a  similar behaviour to the dynamic controls... they need to be recreated on postback.

mavrick_101

so that I don't have to call sql server again
you can save the datatable in a session object or viewstate or other option.

Any doubt, post your comment.

Yes Mavrick , calling SQL server by queries and update table is needed in each postback. because you can't know when the user will leave the page except if there is a save button to confirm the operation.

In this case you can use an Updatepanel.

[RESOLVED] TreeView Usage like Win dows Forms

I have a good deal of experiences with Windows forms. Now I'm on to ASP.NET using VWD 2010 Express. I wanted to use the TreeView web control the same way as the same control in WinForms. However, it seems to be contructed for navigation rather than representing data. Can that controll have its node names set by code that I write?

Hi,

LouOttawa

it seems to be contructed for navigation rather than representing data

I think you saw some tutorial in which it got connected with a web.sitemap file right? If so then fear not, you can also make use of another data store like a database to display data in the treeview.

Grz, Kris.

XIII

I think you saw some tutorial in which it got connected with a web.sitemap file right? If so then fear not, you can also make use of another data store like a database to display data in the treeview.

Grz, Kris.

You are quite right. I have a old training book by Microsoft that sonnects a treeview with a sitemap. The book shows nothing else with that treeview. Thank for helping me. It was relief to hear.

 

[RESOLVED] Cgi problem

i am using cgi that i pass company name that generate a excel file 

if i pass

cgiCall.html?file="Edlink" generate a excel file how to download this file

There is absolutely zero way for us to know because we know nothing about the CGI script you are using. CGI is a broad term that means common gateway interface. If it's a script that's getting called, then somewhere there should be some sort of configuration variable that tells the script where to put it. If it's a compiled executable, then you can't peek inside it, but also somewhere there should be some sort of configuration variable to tell the executable where to put the file.