I am attaching an object to my aspx page. Since the object's type is determined at runtime, I want to be able to set the value of this object's type parameter to a hiddenfield value which I set when I run my web application.
<asp:HiddenField ID="hiddenField1" runat="server" />
<object id="myObject"
type="hiddenfield1.value???">
</object>
As you can see in the code snippet above, I need to set the type to the hiddenfield's value. How do I go about this.
Thanks.
I don't know if I understood you correctly but you want to pass the type of an object to the client in a hidden value?
Well I'd do somehting like this:
<asp:HiddenField ID="ObjectType" runat="server" value="<%= typeOf(MyObject).toString() %>" />
I recently uninstalled visual web developer so I can't really tell you if this works or not, but it should.
If this is not what you intended or if it doesn't work, please drop me a comment.
Regards
A couple of thoughts for you:
string myObject = "<object id="Object1" classid="..." type='" + HiddenField1.Value + "' ></object"
).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.