HTML \ asp question

Ido

Freshman
Joined
Oct 12, 2003
Messages
44
Location
Israel
Hi,
I'm writing an asp.net application.
I have a question:
Lets say i have this code in my HTML line:

Code:
onclick="NewOpenWindow('SanitySubTest.aspx?key=1')

Somewhere, in the same page, i have function 'NewOpenWindow' inside java script tags, but that realy not important. You can see above the parameter
"key=1" - how can i make the value of key dynamically change? (not always 1).

..or another example more simple:
in the code below - is it possible to replace the "xx-small" with
a function call which return the Font-Size it want?
Code:
<ItemStyle Font-Size="XX-Small"></ItemStyle>

Thanks.
 
for: Font-Size="XX-Small"

maybe do it dynamically in the code. Look into "style"..something like:
control.style.item("Width") = "200px"

For the first one, can u concat the key number to the string, then stick it into the onClick event? for example, somewhere before onclick, build the string, concat the right keynumber and then use the newly concat string in the onClick..

just a thought,
 
You can add an attribute to a control by:
Code:
ctrl.Attributes.Add("width", "100")
Or in your case:
Code:
ctrl.Attributes.Add("onclick", "NewOpenWindow('SanitySubTest.aspx?key=1')")
But if you are referring to the question you asked here, then you can use DataTextFormatString instead of DataNavigateUrlFormatString in your HyperLinkColumn:
Code:
<asp:HyperLinkColumn DataTextField="cu_id"
DataTextFormatString="<a href=javascript:void(0);
onclick=NewOpenWindow('SanitySubTest.aspx?key={0}')>Click Here</a>"
</asp:HyperLinkColumn>

Note: I don't think you can have "" in your DataTextFormatString. ie.
Code:
DataTextFormatString="<a href=""javascript:void(0);"">"
will generate a parse error.

Hope this helps.
 
Hi, Thanks both for the help!
You've helped me very much.
after i realized how this thing -> ?var={0} work (thanks to you) - and saw few more examples on the web - i put this code - and it work (and the new window get var from the caller window)

PHP:
<asp:HyperLinkColumn Text="<img src='../../../Icons/paper.gif' alt='Details..' Border='0'>" DataNavigateUrlField="Ind." DataNavigateUrlFormatString="javascript:var w =window.open('SanitySubTest.aspx?Ind.={0}',null,'width=730,height=310,location=no')" HeaderText="Details"></asp:HyperLinkColumn>


http://www.datawebcontrols.com/demos/HyperLinkInNewWindowWithJavaScript.aspx
 
Pop up window take too much time to displayed

Do you know why it take 30 seconds(!) to open a new and empty (pop up)window????
 
Last edited:
Back
Top