![]() |
|
|
|
#1 |
|
Hello
I want to know that can I use Response.Write for ouput value of a property for instance <Td width='<%= StaticFunction() %>' /> thanks in advance pers |
|
|
|
|
#2 |
|
Posts: n/a
|
On Nov 4, 8:52*am, "pers" <reza...@hotmail.com> wrote:
> Hello > I want to know that can I use Response.Write for ouput value of a property > for instance <Td *width='<%= *StaticFunction() %>' /> > > thanks in advance protected string StaticFunction() { return "50"; } Alexey Smirnov |
|
|
|
#3 |
|
Posts: n/a
|
I read that as...
Response.Write("<Td width='<%= StaticFunction() %>' />") though I could be wrong... If that is the case, then add to what Alexy wrote... Response.Write("<Td width='" + StaticFunction() + "' />") -- Best regards, Dave Colliver. http://www.AshfieldFOCUS.com ~~ http://www.FOCUSPortals.com - Local franchises available "Alexey Smirnov" <> wrote in message news:eebc6591-4ee3-4404-9b30-... On Nov 4, 8:52 am, "pers" <reza...@hotmail.com> wrote: > Hello > I want to know that can I use Response.Write for ouput value of a property > for instance <Td width='<%= StaticFunction() %>' /> > > thanks in advance protected string StaticFunction() { return "50"; } David |
|
|
|
#4 |
|
Posts: n/a
|
Lets not start the top post / bottom post debate. I post where my cursor is
placed when I respond. If the rules change, tell MS. I know how the = works, I read his question as how to write out the whole string of <Td width='<%= StaticFunction() %>' /> in a Response.Write statement, which of course won't really work... the <%=....%> would require some form of very late binding to evaluate the StaticFunction, which won't work, hence my alternative of writing out without the <%= %>. The question was about writing it out, not really about the rights and wrongs of writing it in a Response.Write. If I was to be writing something out using Response.Write, I would do it that way, alternatively, I would be using a label or a literal to write it... <asp:Literal id="MyLit" runat="server" Text="<%=StaticFunction()%>" /> -- Best regards, Dave Colliver. http://www.AshfieldFOCUS.com ~~ http://www.FOCUSPortals.com - Local franchises available "Mark Rae [MVP]" <> wrote in message news:... > "David" <> wrote in message > news:... > > [please don't top-post] > >>> I want to know that can I use Response.Write for ouput value of a >>> property >>> for instance <Td width='<%= StaticFunction() %>' /> >>> >>> thanks in advance >> >> protected string StaticFunction() >> { >> return "50"; >> } > >> I read that as... >> >> Response.Write("<td width='<%= StaticFunction() %>' />") >> >> though I could be wrong... > > You are. The equals sign is shorthand for Response.Write and is used to > inject server-side content into client-side markup - that's what <%...%> > is for. > > >> If that is the case, then add to what Alexy wrote... >> >> Response.Write("<td width='" + StaticFunction() + "' />") > > That is server-side code which is trying to inject additional characters > into the HTML stream, and should be avoided at all costs. ASP.NET is > object-orentated, not liner like ASP, and you often have very little > control over where the characters you are injecting will actually end up. > However, this problem doesn't exist in the way Alexey demonstrated because > the injected characters can only appear between the <%...%> tags. > > > -- > Mark Rae > ASP.NET MVP > http://www.markrae.net David |
|
|
|
#5 |
|
Posts: n/a
|
pers wrote:
> Hello > I want to know that can I use Response.Write for ouput value of a property > for instance <Td width='<%= StaticFunction() %>' /> > > thanks in advance > Yes. The method that you want to call has to be protected (or public) so that the page can reach it. -- Göran Andersson _____ http://www.guffa.com Göran Andersson |
|
![]() |
| Thread Tools | Search this Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| response write | Homeworker | Computer Support | 3 | 04-23-2007 09:58 AM |
| Unable to Read/Set Text Box in ASPX Web page using Javascript | rameshk75 | Software | 0 | 10-25-2006 03:34 PM |