xmldatasource

Handling XmlDataSource when remote XML source not available

陌路散爱 提交于 2020-01-17 07:02:26
问题 When using an XmlDataSource is there good way to handle exceptions that are caused when the remote XML file is unavailable? I'm somewhat new to .NET and using C#. 回答1: It's really up to you to determine what is suitable for your application when an exception like this is raised. The only thing you shouldn't do is ignore it. Options you have include: Automatically retry a number of times, in case the connection problem is transitory Return an appropriate error message to the user and perhaps

Load XML Data (Key/Value Pairs) into Data Structure

a 夏天 提交于 2020-01-12 10:51:55
问题 I have an XML Data Source which contains a list of key/value pairs. I'm looking for a simple way to load the same data into an array or some other data structure so that I can easily look up the data. I can bind it to a GridView with a couple of clicks but I'm failing to find a straightforward way to load it into something that isn't a UI Control. My data source looks like: <SiteMap> <Sections> <Section Folder="TradeVolumes" TabIndex="1" /> <Section Folder="TradeBreaks" TabIndex="2" /> <

Load XML Data (Key/Value Pairs) into Data Structure

不羁的心 提交于 2020-01-12 10:49:08
问题 I have an XML Data Source which contains a list of key/value pairs. I'm looking for a simple way to load the same data into an array or some other data structure so that I can easily look up the data. I can bind it to a GridView with a couple of clicks but I'm failing to find a straightforward way to load it into something that isn't a UI Control. My data source looks like: <SiteMap> <Sections> <Section Folder="TradeVolumes" TabIndex="1" /> <Section Folder="TradeBreaks" TabIndex="2" /> <

How do I pass a xml attribute to xslt parameter?

岁酱吖の 提交于 2020-01-03 01:58:06
问题 I got everything working (thank empo) except the ctrlname column. I don't know the syntax well enough. What I am trying to do is use the xslt to sort the xml in the gridview by the column name. Everything is working but the ctrlname column. How do I pass an attribute to the XSLT? I've tried: @name, Data/@name, Data[@name], ctrlname. Nothing works. XmlDataSource1.EnableCaching = False Dim xslTrnsform As System.Xml.Xsl.XsltArgumentList = New System.Xml.Xsl.XsltArgumentList xslTrnsform.AddParam(

asp:HyperLink build NavigateUrl within Repeater using XPATH data

旧城冷巷雨未停 提交于 2019-12-25 01:23:45
问题 I am using a repeater for some products I am listing. I'm trying to build an asp:HyperLink NavigateUrl using both hardcoded text as well as XPATH data. NavigateUrl='mypage.aspx?ID=<%#XPath("THEID")%>&name=<%#XPath("THENAME")%>' Obviously this isn't working. Does anyone know how to make this work? 回答1: This should work: <asp:HyperLink runat="server" NavigateUrl='<%# string.Format("mypage.aspx?ID={0}&name={1}", XPath("THEID"), XPath("THENAME")) %>' Text="some link" /> 来源: https://stackoverflow

MSTest data driven Test set DisplayName for Rows from DataSource

白昼怎懂夜的黑 提交于 2019-12-23 07:06:04
问题 How can I set the DisplayName of a Data Row in data driven tests, where the data source is a XML and the provider is Microsoft.VisualStudio.TestTools.DataSource.XML. XML: <?xml version="1.0" encoding="utf-8" ?> <environments> <environment><name>IE</name></environment> <environment><name>Chrome</name></environment> </environments> App Config: <!-- CONNECTION STRINGS SETTINGS --> <connectionStrings> <add name="IE_Chrome" connectionString="IE_Chrome.xml" providerName="Microsoft.VisualStudio

Jasper list element inside table element with XML datasource

懵懂的女人 提交于 2019-12-22 04:03:29
问题 I'm trying to generate a report, using Jasper iReport Designer 5.6.0 , with table that contains lists inside its cells. The generated table could look like this: To do this, I'm using the following XML file as datasource: <report> <table> <persons> <person> <id>111</id> <name>John</name> <addresses> <address>Johan's Street 1</address> <address>Johan's Street 2</address> <address>Johan's Street 3</address> </addresses> </person> <person> <id>222</id> <name>Marko</name> <addresses> <address

How do I pass a XSLT parameter to a XmlDataSource correctly?

☆樱花仙子☆ 提交于 2019-12-12 05:55:45
问题 I believe I have all the code correct but I can't get it to work. The GridView has allowSorting = true. So in theory, when I click on the column header the xml in the gridview should sort by that column. The XML shows in the GridView, but doesn't sort at all. I'm stumped. DST_Test.Xml <?xml version="1.0" encoding="utf-8" ?> <root> <data name="Test1.Text" xml:space="preserve"> <value>Please Pick Bare Pump</value> <comment>Tab - Pump Configuration</comment> </data> <data name="Test2.Text" xml

Binding to XMLDataProvider

时间秒杀一切 提交于 2019-12-12 04:49:54
问题 Made a simple test project where i try to bind to a xmldatasource in a proto viewmodel public partial class Window1 : Window { //private XmlDataProvider _provider = new XmlDataProvider(); private MyViewModel _myViewModel = new MyViewModel(); public Window1() { InitializeComponent(); this.DataContext = _myViewModel ; } } public class MyViewModel { public MyViewModel() { LoadXMLData(); } private XmlDataProvider _provider = new XmlDataProvider(); public XmlDataProvider Reports { get { return

RadioButtonList inside Repeater bound to XmlDataSource

ⅰ亾dé卋堺 提交于 2019-12-12 03:04:25
问题 I have the following XML: <questions> <question text="This is a test question?"> <answer value="Yes"> <requirement articleId="2899"/> </answer> <answer value="No"> <requirement articleId="2899"/> </answer> </question> </questions> And I have the following markup in my ASPX page: <asp:Repeater ID="rptQuestions" runat="server" DataSourceID="xdsQuestions"> <ItemTemplate> <p> <asp:Label ID="lblText" runat="server" Text='<%# Eval("text") %>' /> </p> <div> <asp:RadioButtonList ID="rblAnswers" runat