.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Load XML data (string format - not file) into a gridview

Posted By:      Posted Date: October 22, 2010    Points: 0   Category :ASP.Net



 I need some help help loading some XML tagged data I received as a reply from a Web Service (String format), into individual fields on the web form.


After spending some time,  I was able to load an XML file into a gridview using this code...

<?xml version="1.0" encoding="ISO-8859-1"?>
        <title>Empire Burlesque</title>
        <artist>Bob Dylan</artist>
        <title>Hide your heart</title>
        <artist>Bonnie Tyler</artist>
        <company>CBS Records</company>

View Complete Post

More Related Resource Links

String Data missing start from "+" When Export Data To Excel Using Gridview

Hi,I am exporting data from gridview to excel file.My problem is that for all the string which contain "+", the rest of data begining from it is missing in excel file.For example: PWE-WER+78, when exported it will become PWE-WER.Below is my code.                Response.ClearContent() Response.Buffer = True Response.AddHeader("Content-Disposition", "attachment;filename=" & "ExportedExcel.xls") Response.ContentType = "application/vnd.ms-excel" Response.Charset = "" lobjStringWriter = New StringWriter lobjHtmlWriter = New HtmlTextWriter(lobjStringWriter) dgdResult.RenderControl(lobjHtmlWriter) Response.Write(lobjStringWriter.ToString()) Response.End() I  have search through online but no solution.Does anyone has idea on this?

Could not load file or assembly "System.Data.DLL" or one of its dependencies

Could not load file or assembly "System.Data.DLL" or one of its dependencies

My problem with an gridView, Input string was not in a correct format.

Hello all ! I'am actually encounter problem with an gridView which is composed of five columns, the both first are string type, third is date and the two last are linkbutton to edit or delete rows. On clicking edit button, i catch good event to edit and traitment  work fine but on living function an error occur with this message : error : System.FormatException: Input string was not in a correct format. stackTrace :   [FormatException: Input string was not in a correct format.] System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) +7471479 System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) +119 System.Web.UI.WebControls.GridView.GetRowIndex(GridViewRow row, String commandArgument) +99 System.Web.UI.WebControls.GridView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup) +602 System.Web.UI.WebControls.GridView.RaisePostBackEvent(String eventArgument) +207 System.Web.UI.WebControls.GridView.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +175 System.Web.UI.Page.ProcessRequestMain(Boolean inclu

Unable to export data to an excel file in grid format!!!

I'm exporting data to an excel sheet from the ojects list. The data is exporting to excel sheet well, but I'm unable to see the grid format for the data. The data is looking with out the rows and columns lines. I think I'm missing to set some property or somethnig ehwn exporting.   Any help would be really appriciated.

How to populating GridView with data from XML file?

Hi, I am quite a new to the ASP.NET field and trying to populate a gridview with data from xml file. I have already done this using code bihind(C#) when the xml file is simple, like below: Dennys 730 W. Carson St. Torrance CA 90502 5625555555 4 The best burger joint in California! And code bihind: protected void GridView1_PreRender(object sender, EventArgs e) { DataSet ds = new DataSet(); ds.ReadXml(Server.MapPath("RestaurantData.xml")); GridView1.DataSource = ds; GridView1.DataBind(); } But say if I have multiple child of a node in the XML file, say, Dennys 730 W. Carson St. Torrance CA 5625555555 www.tcs.com Then how to load this data(phone & website) in a gridview column using code behind(C#)? And what else I have to do with my aspx page also? Please help!

writing xml data to a string instead of a file

Hi   I have a code that generate xml file from a database table and write the data in a xml file that is created by the program itself  // create xml file and xml writer XmlTextWriter xmlwrtr = new XmlTextWriter("c:\\SitemapTEST2.xml", null); I would like to write the xml data as a string and pass it to a datasource connection , how is this possible? something like this  this.ExplorerBarDataSource.Data = @"<?xml version='1.0' encoding='UTF-8'?> <countries> <country name='United States'> <state name='Alabama'> <city name='Montgomery' pubulation='22,000'/> <city name='Birmingham'/> <city name='Tuscaloosa'/> <city name='Huntsville'/> </state> </country> </countries>";     thanks    

Unable to load data from txt file with text delimiter specified, if the data has the same character


Have come across a strange scenario and seeking your ideas/thoughts.

I'm using a ssis package to load a txt file. The txt file is text delimited by double quote (") and column delimited by tilde (~). It works fine in most scenarios and strips the enclosing "" from the columns -no problems there. However, in a specific scenario where the last column has double quote in the data as well being the text delimiter, the package throws the following exception indicating that it's missing a column delimiter

 The column delimiter for column "COL_NAME" was not found

This behaviour was not observed when double quotes were present as data in any other column in the file. Was able to workaround by disabled text delimiter only for the last column, but that isn't a perm solution. Also observed that if the " was replaced by escape sequence /" the file loaded successfully. Wondering if this a known issue ?


populating textboxes via data reader - how do I format the string??


Here is what I have tried:

txtCost.Text = string.Format("{o:c}", dr["Cost"]);

Here is the error I receive.  How can I format the data that is coming from the data reader into currency format???  Also, is there a way to format it into currency without the dollar sign?

Input string was not in a correct format.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.FormatException: Input string was not in a correct format.

How to Format Data inside a Bound Column of Gridview?



I have a bound column.

<asp:BoundField DataField="WorkPreference"  HeaderText="WorkPreference"
                    <HeaderStyle HorizontalAlign="Left" />

dr["WorkPreference"] = sa.WorkPreference ( This is how I bind the data  to a DataRow)

The example of the data which gets bound to this column is like the following:

Communications and Marketing Officers; Environmental Assessors; Geologists and Geosciences; Geospatial/Spatial Information Officers;

What I want is that the data should be presented to the user like the following:

Communications and Marketing Officers

Environmental Assessors

Geologists and Geosciences

Geospatial/Spatial Information Officers

In short: I basicaly want to put a break where there is a colon and then bind the data to the gridview.

It looks like simple but if you can let me know. Thanks.

system.io.fileloadexception - could not load file or assembly system.data.sqlserverce version=3.5.1.



my application raises this exception but the file system.data.sqlserverce.dll is in the folder of the application, and the version is correct.


do u have any idea about this problem ?


thanks in advance for every answer Smile


hello from switzerland !



how to load data in file XML to richtextbox


 am developing a windows application, in which I am giving two options to the user for the file selection.

1. Open File Dialog

2.select  file 

3.load data in file to richtextbox


load data in file to textbox

private void button1_Click(object sender, EventArgs e)
            OpenFileDialog fs = new OpenFileDialog();
            fs.InitialDirectory = "x:\\";
            fs.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*";
            fs.CheckFileExists = true;
            fs.RestoreDirectory = true;
            fs.InitialDirectory = Application.StartupPath;

            if (fs.ShowDialog() == DialogResult.OK)
                rtxtbox.LoadFile(fs.FileName);    //i have a problem in this here

Serious problem on UpdatePanel and GridView (Input string was not in a correct format)


I have implemented a custom gridview paging method using the pagertemplate tag. The source code is the following:



<asp:UpdatePanel ID="UpdatePanel1" runat="server">
      		<fieldset class="ads">
			<br />            
            <asp:GridView ID="gvResults" runat="server" AutoGenerateColumns="False" DataKeyNames="CHId" CssClass="grid" GridLines="None" AllowPaging="true" AllowSorting="true&q

how to load data with the file name?


We are loading data from xls/txt/csv files into our existing Db tables, but with this we want to also store file name into our table column, how to achieve it?


gridview data format



Can anyone help me with doing this.

I have a gridview which has 3 columns declared where the 3rd column doesnot have any data from the source.

After the data is displayed , I have a textbox taking an input. Depending on the textbox value-- calculations have to be done for each row in the grid and the grid needs to be refreshed with the new values for the 3rd column.

Dynamically format string value in gridview


I have a gridview that is built  using a objectdatasource and set to autogenerate the columns based on that source, on some other pages i have a gridview that is built within the page with template fields and so on..

in that gridview i have a field that displays the time value like so

<asp:Label ID="lblstartDate" runat="server" Text='<%# DataBinder.Eval(Container.DataItem,"startDate", "{0:t}") %>'

Could Not Load File or assembly 'MySql.data'



I am trying to test website on a remote server to see if I can read or write to a MySql Database.

In VS Web developer 2010 Express edition, I created a new website and saved it via ftp on the remote host. I have added the 'Mysql.data.dll' to the website and placed it in the bin directory of the project.

When I try to run the program i get "Could not load File or assembly MySql.Data, Version=, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies. The system cannot find the file specified.

Line 4:  		<compilation debug="true" urlLinePragmas="true">
Line 5:        <assemblies>
Line 6:          <add assembly="MySql.Data, Version=, Culture=neutral, PublicKeyToken=C5687FC88969C44D"/>
Line 7:        </assemblies>
Line 8:      </compilation></system.web></configuration>

The remote server supports .Net v2, so I have made my application focused on v2 framework.  I have tried similar code on my local machine and works fine.

Can anyone pls advice what I might be doing wrong?



ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend