|
ok , now Post the Complete Error that you get. Dont edit it, just post it the way comes
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
In the LAN Settings(in Connection Tab of Internet options) of my browser I had added the url in the "DONOT USE PROXY", now it is working.
is this the correct way...?
Imtiaz A.K
|
|
|
|
|
The below is the error which Iam gettig before..
Network Error (tcp_error)
A communication error occurred: ""
The Web Server may be down, too busy, or experiencing other problems preventing it from responding to requests. You may wish to try again at a later time.
Imtiaz A.K
|
|
|
|
|
Hi all.
I'm programming an site, where I create a file on server side, an I need it to be downloaded to client after it finishes.
At this moment, I am coding it step by step:
- A button to create the file
- Another button to download it, once it is created.
I can create the file correctly, but when I try to download it this is what happens:
There is an asp:textbox where I have the name of the file (I get the path with Request.ServerVariables("APPL_PHYSICAL_PATH") so that's OK)
Then I press the input type=button control I have, and call a javascript function like this:
<script type="text/javascript">
function Download(nom_fich)
{
window.open("Downloadfile.aspx?ar=" + nom_fich,"Download","width=10,height=10,resizable=yes;top=200,left=150,menubar=no,toolbar=no,status=no,location=no");
}
</script>
Once I am on the Page_Load event of the Downloadfile.aspx page, I get the parameter from "ar" and I just get "undefined".
I don't know if the problem is when taking the file name from the asp:textbox control, because when I get it from an input control, it is OK...
Please, help me, I have been searching for an answer for so long, and I can't stand it anymore.
Thanks in advance.
PS: This is the input button I use:
<input id="Bt_Descarga" class="" visible="TRUE" style="width: 100px" type="button" value="Download" onclick="Download(txtFile.text)" />
And this is the asp:textbox control I need to take the filename from.
<asp:Textbox ID="txtFichero" runat="server" CssClass="cuerpopar" Width="100%"></asp:Textbox> <pre>
<div class="ForumSig">Time to come clean...
Vive y deja vivir / Live and let live
Javier</div>
|
|
|
|
|
Have you looked at the URL at all ?
garfield185 wrote: onclick="Download(txtFile.text)" />
This quite obviously does not work. You need to get the client side id of the control, then use document.getElementById to look up the control, then get it's actual text. You can use the alert function to debug your code, if you do that now, you'll find that it's null, which is why you're getting the result you are.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
OK, I have no idea what you are talking about... Sorry!!! Could you please write a clue?
Time to come clean...
Vive y deja vivir / Live and let live
Javier
|
|
|
|
|
txtFile.Text is not valid javascript. So, it's not working. On the server side, you can get the client side id of your control ( which is not even called txtFile, from what you posted ), and then you can use document.getElementById(clientId) ( where clientId contains that id you got from the server ), to get a reference to the actual control. Then you can get the text of the control ( I think .value is what you want, it's sure not .text ).
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Do you know any web page with an example of all this you are writing?
Time to come clean...
Vive y deja vivir / Live and let live
Javier
|
|
|
|
|
Well, if I were to google getElementById, I know I'd easily find that part of it. As for the rest, just use RegisterClientScript to emit javascript from the server that creates a variable which contains the client side id of your textbox, using the ClientID property.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
just:
<pre>
onclick="Download(document.getElementById('txtFile').value)"
</pre>
|
|
|
|
|
|
I think you'll find that this is utterly wrong.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Yes. I know so I have deleted that post after posting it.
Thanks
please don't forget to vote on the post that helped you.
|
|
|
|
|
garfield185 wrote:
Why dont you pass :
onclick = "javascript:Download(document.getElementById('<%=txtFile.ClientId%>').value);"
I hope this would work perfectly. If not let me know.
|
|
|
|
|
YOU ARE THE BEST!!!!
It works perfectly, thanks a lot!!!
Time to come clean...
Vive y deja vivir / Live and let live
Javier
|
|
|
|
|
you are most welcome my friend..
Cheers.
|
|
|
|
|
Interesting, when I've tried to do that directly, it's not done the translation to emit the client id, it's appeared in my javascript verbatim. That's why I advocate storing the client side id in a variable.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Yes... Its the same thing.
I dont know why he didnt understand.
|
|
|
|
|
Well, your solution was so simple that you could give him one line of code. I do tend not to give code, because it makes people think and understand, but in this case, my experience made me feel that may not actually work. Perhaps I've just done it in a specific context where it wouldn't process the server tags ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Might be. Can you show me where it is not working.
I think there must be problem of mixing up server tags within server side controls.
For example If you write :
<asp:TextBox ID="txt" Text="<%= this.somevariable %>" runat="server" />
You will actually end up with a textbox which has value
<%=this.somevariable%>
rather than the value of the variable.
on the other hand if you write :
<input type="text" id="txt" value="<%= this.somevariable %>" />
It will properly show the value of the variable in the textbox.
In your case this might be the issue.
|
|
|
|
|
Hey.
I am working on application in which I want to create dynamic controls and retrives them in html string.
for example.
public string CreateControl()
{
HtmlTable hTable = new HtmlTable();
hTable.CellPadding = 2;
hTable.CellSpacing = 2;
hTable.Width = "100%";
HtmlTableRow hRow = new HtmlTableRow();
HtmlTableCell hCell = new HtmlTableCell();
hCell.InnerText = "Username";
hRow.Cells.Add(hCell);
hTable.Rows.Add(hRow);
// Now here I want to return created controls in html string.
}
It should be like this
<table CellPadding=2 CellSpacing = 2 Width=100><tr><td>Username</td></tr></table>
Thanks
Imrankhan
please don't forget to vote on the post that helped you.
|
|
|
|
|
Your best bet to do that, is to use a string builder to generate the HTML yourself.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Christian Graus wrote: Your best bet to do that, is to use a string builder to generate the HTML yourself.
I have to write all controls in HTML and I dont want to write inlinne code at server side. I know It is possible because I had done it before one year ago when I worked on custom control but now I forget it.
regard
Imrankhan
please don't forget to vote on the post that helped you.
|
|
|
|
|
You're right, 5 seconds with google got me this:
public string RenderControl(Control ctrl)
{
StringBuilder sb = new StringBuilder();
StringWriter tw = new StringWriter(sb);
HtmlTextWriter hw = new HtmlTextWriter(tw);
ctrl.RenderControl(hw);
return sb.ToString();
}
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Thanks Christian.
please don't forget to vote on the post that helped you.
|
|
|
|