Modify <param> value from code
I am trying to embed a visio doc in an aspx page using the following code
<OBJECT classid="CLSID:279D6C9A-652E-4833-BEFC-312CA8887857"
codebase="http开发者_StackOverflow中文版://download.microsoft.com/download/4/5/2/452f8090-413f-408f-83c0-edd66db786ee/vviewer.exe"
id="viewer1" width="100%" height="100">
<param name="BackColor" value="16777120">
<param name="AlertsEnabled" value="1">
<param name="ContextMenuEnabled" value="1">
<param name="GridVisible" value="0">
<param name="HighQualityRender" value="1">
<param name="PageColor" value="16777215">
<param name="PageVisible" value="1">
<param name="PropertyDialogEnabled" value="1">
<param name="ScrollbarsVisible" value="1">
<param name="ToolbarVisible" value="1">
<param name="SRC" value="http://wssxxxx/Shared%20Documents/Yukon%20Timeline.vsd">
<param name="CurrentPageIndex" value="0">
<param name="Zoom" value="-1">
</object>
i need to modify the value
parameter SRC
from code , how do i go about it ?
Use a code block:
<param name="SRC" value="<%:MyValue%>">
Or this (if not using .NET 4.0):
<param name="SRC" value="<%=Server.HtmlEncode(MyValue)%>">
In your page, you can create a string property called MyValue
:
public string MyValue { get; set; }
And set it in code to whatever you need:
// In page_load
MyValue = "http://example.com/code_blocks.vsd";
You can have it run at server:
<param name="SRC" id="prmSrc" runat="server" />
And in your code behind:
prmSrc.Attributes["value"] = "...";
精彩评论