How To Make XML File In .net Mvc
Mar 12, 2010i want to make XML file for RSS news. Can anyone tell me How to create XML file?
View 1 Repliesi want to make XML file for RSS news. Can anyone tell me How to create XML file?
View 1 RepliesI stacked with making xsl file, for attaching it to the treeview.
This is my XML File:
<?xml version="1.0" encoding="utf-8" ?>
<div id="menu">
<ul class="folder"><a href="Default.aspx?PageName=default">Category</a>
<li class="doc"><a href="Default.aspx?PageName=a">menu item 1</a></li>
<li class="doc"><a href="Default.aspx?PageName=a">menu item 2</a></li>
<li class="doc"><a href="Default.aspx?PageName=a">menu item 3</a></li>
</ul>
<ul class="folder"><a href="Default.aspx?PageName=default">Category2</a>
<li class="doc"><a href="Default.aspx?PageName=a">menu item1</a></li>
<li class="doc"><a href="Default.aspx?PageName=a">menu item 2</a>
</li>
</ul>
<ul class="folder"><a href="Default.aspx?PageName=a">Category3</a>
<li class="doc"><a href="Default.aspx?PageName=a">menu item 1</a></li>
<li class="doc"><a href="Default.aspx?PageName=a">menu item 2</a></li>
</ul>
<ul class="folder"><a href="Default.aspx?PageName=a">Category4</a>
<li class="doc"><a href="Default.aspx?PageName=a">menu item 1</a></li>
<li class="doc"><a href="Default.aspx?PageName=a">menu item 2</a></li>
<li class="doc"><a href="Default.aspx?PageName=a">menu item 3</a></li>
<li class="doc"><a href="Default.aspx?PageName=a">menu item 4</a></li>
</ul>
</div>
[Code]....
and here is a code in aspx page:
<asp:TreeView ID="TreeView1" runat="server" DataSourceID="XmlDataSourceTreeview">
<Databindings>
<asp:TreeNodeBinding DataMember="folder" TextField="title"/>
Here should be additiona datamembers....
</Databindings>
</asp:TreeView> <asp:XmlDataSource ID="XmlDataSourceTreeview" runat="server" DataFile="~/Menu.xml" XPath="div" TransformFile="~/Menu.xsl"></asp:XmlDataSource>
I am generating a text file on server. I want this file to be able to get downloaded by clients accessing the site. Like, when the file is generated a link should appear on the page that says,"Download the File". Clicking that will run a code that will download te file and save it on client's PC. How to do this?
View 3 RepliesI am using Visual Studio 2010 and I want to make some reports dynamically. I want to display in the reports viewer my own created dataSet and table adapter. Is this possible? Or it is possible to change the connection string from the dataset at runtime? I have different connections strings which are defined in the settings.xml file and i want to use this strings at connection.
View 1 Repliesi am new to wcf and below is what the WCF WSDL returns, my question is, how to call a WCF service from html page?
[Code]....
I try to use internationalization in MVC but I can not make the resource strings public to my application.If I follow Steve Sanderson then I have to create a resource file and enter my strings. But in the window to enter the strings I can not choose the drop down to change the modifier because it is inactive (grey).
View 2 RepliesHow to make exported .XLS file Editable Thid code makes .XLS File Read Only
:(
using System;
using System.Data;
using System.Configuration;
using System.IO;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public class GridViewExportUtil
{
/// <param name="fileName"></param>
/// <param name="gv"></param>
public static void Export(string fileName, GridView gv)
{
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.AddHeader(
"content-disposition", string.Format("content-disposition", "attachment; filename={0}", fileName));
HttpContext.Current.Response.ContentType = "application/ms-excel";
HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache);
HttpContext.Current.Response.Charset = System.Text.Encoding.Unicode.EncodingName;
HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.Unicode;
HttpContext.Current.Response.BinaryWrite(System.Text.Encoding.Unicode.GetPreamble());
using (StringWriter sw = new StringWriter())
{
using (HtmlTextWriter htw = new HtmlTextWriter(sw))
{
// Create a form to contain the grid
Table table = new Table();
// add the header row to the table
if (gv.HeaderRow != null)
{
GridViewExportUtil.PrepareControlForExport(gv.HeaderRow);
table.Rows.Add(gv.HeaderRow);
}
// add each of the data rows to the table
foreach (GridViewRow row in gv.Rows)
{
GridViewExportUtil.PrepareControlForExport(row);
table.Rows.Add(row);
}
// add the footer row to the table
if (gv.FooterRow != null)
{
GridViewExportUtil.PrepareControlForExport(gv.FooterRow);
table.Rows.Add(gv.FooterRow);
}
// render the table into the htmlwriter
table.RenderControl(htw);
// render the htmlwriter into the response
HttpContext.Current.Response.Write(sw.ToString());
HttpContext.Current.Response.End();
}
}
}
/// <summary>
/// Replace any of the contained controls with literals
/// </summary>
/// <param name="control"></param>
private static void PrepareControlForExport(Control control)
{
for (int i = 0; i < control.Controls.Count; i++)
{
Control current = control.Controls[i];
if (current is LinkButton)
{
control.Controls.Remove(current);
control.Controls.AddAt(i, new LiteralControl((current as LinkButton).Text));
}
else if (current is ImageButton)
{
control.Controls.Remove(current);
control.Controls.AddAt(i, new LiteralControl((current as ImageButton).AlternateText));
}
else if (current is HyperLink)
{
control.Controls.Remove(current);
control.Controls.AddAt(i, new LiteralControl((current as HyperLink).Text));
}
else if (current is DropDownList)
{
control.Controls.Remove(current);
control.Controls.AddAt(i, new LiteralControl((current as DropDownList).SelectedItem.Text));
}
else if (current is CheckBox)
{
control.Controls.Remove(current);
control.Controls.AddAt(i, new LiteralControl((current as CheckBox).Checked ? "True" : "False"));
}
if (current.HasControls())
{
GridViewExportUtil.PrepareControlForExport(current);
}
}
}
}
I have an asp.net mvc project, its build just from views, controllers, models, and other files. I have any codebehind file in my views. Does it makes sense to create them for using sometime? Is it some situation when they giving more abilities and advantage for developer?
View 3 RepliesHow can i Make A Text File In Memory(Ram -> Save NoWhere) And Write Something On It And Open NotePad on top of Client browser And Open That Text File In It And Let the user save it by him/her self? -> in code behind
View 1 RepliesI have a hquery plugin that consists of jquery itself, 2 .js files and some script to configure the plug-in which resides on the page. I noticed that in .net you can create a .js file.What I would like to do is put the configuration inside a .js file created in .net, but how do I then reference this in the header of the page
View 1 RepliesI need to make a backup file(.bak) of a database(.mdf)
I learned I need to use MS SQL Server management studio Express to do so, but I can't figure it out how.
I don't know how to connect to the database using this program. In the "Connect to Server" dialogue window, I am supposed to choose a server name from the dropdown list, but nothing comes up. What am i doing wrong?
I need to make a back up file(.bak) from my database (.mdf)
I learned that i need to use Ms SQL Server management studio express. I can't figure out how to connect to the database. looks like I need to select a server type, but nothing comes up for me to select. The databse was made using visual developer 2008 ms sql server, so i thought something like "SQl Server 2005 or 2008" comes up, but it didn't.
how to make a copy of a report! I have a report completed - i wanted to make a copy of this report and change a few things to make a new report. (Rather than starting from scratch.) Within VS 2008, if i right-click on the report and hit copy, then right-click on the folder to paste a copy, paste is not an available option.
View 2 RepliesI've been trying to get my Web Service in my wcf project to be able to reference the resource objects in my resource file but to no avali.Please kindly advice and assist on what went wrong.
View 1 RepliesI'm trying to let the user download different documents where the data is stored in an SQL DB. In firefox, the filetype is correctly read, but not in IE. I'm trying to do this without having to set the ".pdf" or whatever extension the document has, because I haven't got that information. I only have the filetype.
[Code]....
how to make any text file on the client computer ?
can i get any C# asp.net sample code ?
Is it possible to make a sql connection in the master-file for my asp.net website, that all included sites have the connection too? Like when I include a header-file in asp classig.
View 1 RepliesIf more than one person is using the web application, and the web application requires to read a specific file (and in my case, I use StreamReader), I've noticed that the any other instance of the web application would have an exception error when trying to read a file. How do you handle this? And how about when it comes to writing to the same file (if possible)?
View 5 RepliesI am using some code I found that generates a random password. I am in the habit of putting code in a seperate file. The code was written in the same file and I'm trying to move it to a seperate file and get the following message. Also, below, I posted
the original code (code on same page as aspx) and what I did (code in seperate file).what adjustment needs to be made to make the seperate code file work?
Compiler Error Message: BC31143: Method 'Public Function GeneratePassword(length As Integer, numberOfNonAlphanumericCharacters As Integer) As String' does not have a ignature compatible with delegate 'Delegate Sub EventHandler(sender As Object, e As System.EventArgs)'.
Source Error:
[Code]....
ORIGINAL CODE (with code on same page)
[Code]....
MY CODE BEHIND
[Code]....
[Code]....
On my master page (for all pages in my site) I have a ToolkitScriptManager.
On my content page, there are a series of hyperlinks and divs for collapsible functionality.
The code to show/hide the panels work like the following:
[code]....
If I include a ScriptReference to the jQuery 1.4.2 file in the toolkitscriptmanager, the javascript code is executed incorrectly on the page (only the text for the hyperlink is changed, the div is not actually shown.) However, if I don't include the jQuery file in the ToolkitScriptManager and instead include it in the content page, it works correctly.
I don't want to have to set font and stuff for every control in my web app.I have a basic understanding of css but i am yet to find a tutorial which will let me do what i want to do (and trust me, i've looked).I don't want anything fancy. I just want to have one single css file which i go to in order to change the appearance of everything.
to have a single css file to handle appearance for all different kinds of controls, or do you need one per control type?
how to make any text file on the client computer ?can i get any C# asp.net sample code ?
View 4 RepliesI want to send HTML emails from .html files, using Asp.net. To be more precise I'm wondering how to take the content of an HTML file and make it the body of my HTML email?
So using, "System.net.mail" how would I make the the Body of the email the content of a chosen HTML file?
how to make exe file of window application in Visual web developer 2008
View 1 RepliesIs there a way to make a new project file using Visual Studio express 2010 using the files downloaded off a server from an asp.net web site? If so what are the steps? I would like to make a new project out of the old files without starting from scratch, I don't want to just edit a couple of things I would like to create a project file using the files I can get off the server if possible. It would be C#.
View 1 Replies