|
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.
|
|
|
|
|
Imran Khan Pathan wrote: please don't forget to vote on the post that helped you.
LatestArticle :Log4Net
Why Do Some People Forget To Mark as Answer .If It Helps.
|
|
|
|
|
ROTFL - yes, that is quite ironic.
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.
|
|
|
|
|
sashidhar wrote: LatestArticle :Log4Net
Why Do Some People Forget To Mark as Answer .If It Helps.
I tried to give him 5 vote but it did't work. when I click on button to vote, it goes to continuous process then I have to refresh page again. I am not able to vote any post here.
please don't forget to vote on the post that helped you.
|
|
|
|
|
Imran Khan Pathan wrote: hCell.InnerText = "Username";
hRow.Cells.Add(hCell);
hTable.Rows.Add(hRow);
// Now here I want to return created controls in html string.
Now use the following to get the string :
StringBuilder sb = new StringBuilder();
StringWriter tw = new StringWriter(sb);
HtmlTextWriter hw = new HtmlTextWriter(tw);
hTable.RenderControl(tw);
string renderedoutput = sb.ToString();
Now find the control string from the object, inspect renderedoutput .
|
|
|
|
|
im using repeater control.had a edit button which redirect to another page(edit.aspx).
in edit.aspx i had few textboxes,ddl's and fileupload controls for images..
using sessions im transferring data of employees from repeater page to edit.aspx page.
similarly i want to transfer images of that particular employee..
tried using handler.ashx im gettin the last uploaded image(image control) for every employee...
help me....
repeater page
protected void Repeater1_ItemCommand1(object source, RepeaterCommandEventArgs e)
{
}
if (e.CommandName == "edit")
{
}
edit.aspx
Image1.ImageUrl = "handler3.ashx?staffID=" + ("staffID");
TextBox5.Text = Session["headline"].ToString();
|
|
|
|
|
madhukk wrote: using sessions im transferring data of employees from repeater page to edit.aspx page.
Why not just pass it on the URL ?
madhukk wrote: similarly i want to transfer images of that particular employee..
Where do you store them ?
madhukk wrote: Image1.ImageUrl = "handler3.ashx?staffID=" + ("staffID");
TextBox5.Text = Session["headline"].ToString();
What are you writing this for ? Is it for your own study ? Will it ever be used by anyone ?
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.
|
|
|
|
|
im storing in sql server.
this is used for my project...
|
|
|
|
|
OK, so you're writing it for yourself, or for someone to use ?
Why not just pass the id of the image back to the main page then and load it from there ?
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 not want to be helped anymore ?
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.
|
|
|
|
|
passed id to imageurl of image using session...
now i got it thanks...
and im trying to display thumbnail of the uploaded image.
used temporary data table, its working but as i had many uploads its some complicated...
any other method to display uploded image as thumbnail in image control...
thanks
|
|
|
|
|
madhukk wrote: used temporary data table, its working but as i had many uploads its some complicated...
any other method to display uploded image as thumbnail in image control...
The image is associated with the user, right ? So, just write a http handler that takes the id of the image or the user on the query string, looks up the data and returns it. Make this the URL for your image.
madhukk wrote: passed id to imageurl of image using session...
I'm not sure why you're asking me for advice, as you appear to, in every step, doing the opposite of what I've suggested. Filling your session with all this data is going to affect performance.
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.
|
|
|
|
|
can we display the thumbnail of image before inserting into database....
|
|
|
|
|
Why would you want to ? What is it that you're trying to do ? If you'd answer this question it might help me make a recommendation.
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.
|
|
|
|