开发者

How to distribute xap files dynamically in runtime

开发者 https://www.devze.com 2023-03-23 15:17 出处:网络
In my application I download some xml data file from some information center, add to this xml file (in aspx.cs) the column with images and all together I pass to the GridView in aspx file.

In my application I download some xml data file from some information center, add to this xml file (in aspx.cs) the column with images and all together I pass to the GridView in aspx file.

The same I want to do with xap files - I need to add them to the GridView according to the data context, but unfortunately there is a problem - object doesn't have object.Attributes like image.

Here is my code for adding images (gvCurrency is a GridView):

for (int i = 0; i < currency.Count; i++)
{
  Image image = new Image();
  image.Attributes.Add("src", "Images/Currency/" + xdoc.GetElementsByTagName("CURRENCYCODE")[i].InnerText + ".gif");
  image.Attributes.Add("height", "15px");
  image.Attributes.Add("width", "21px");
  gvCurrency.Rows[i].Cells[0].Controls.Add(image);
}

Another possibility, as I think, is in binding links to the corresponding xap files in the aspx file, that in this case should seems like this (if I am not wrong):

<asp:GridView ID="gvCurrency" runat="server"  AutoGenerateColumns="False" ...>
  <Columns>
    <asp:BoundField DataField="FLAG" />
    <asp:BoundField HeaderText="Currency Name" DataField="NAME" />
    ...
    <asp:TemplateField >
      <ItemTemplate>
        <div id="silverlightControlHost">
          <object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="10px" height="10px">
          <param name="source" value="ClientBin/ArrowTriangle.xap"/>
          ...
        </div>
      </ItemTemplate>
    </asp:TemplateField >
  </Columns>
</asp:GridView>

So, my question is: how can I distribu开发者_Go百科te xap files dynamically in runtime (in the first case) and how I can bind links to xap files (in the second case)?

Thanks.

The implementation of the code above is possible to see here: http://www.lzel.net/wf_Currency_ASP.aspx


You can dynamic download xap file from server and put it in cell of table(after render at client side) by javascript(jQuery is best).

0

精彩评论

暂无评论...
验证码 换一张
取 消