|
Hi All,
I dont know if this question is for this forum or I should post it on XML forum. I will transfer the question if you think it is more suitable on that forum.
However, I have a asp.net application in C# where I have a dataset which I can transfer to xml by using the following simple codeblock
string result;
using (StringWriter sw = new StringWriter())
{
ds.WriteXml(sw);
result = sw.ToString();
}
It generates the default xml of the table structure like the following:
<NewDataSet>
<ImageInfo>
<ImageID>1</ImageID>
<ImageName>untitled.bmp</ImageName>
<ImagePath>Some Path</ImagePath>
<Width>800</Width>
<Height>190</Height>
<TileSize>256</TileSize>
<Overlap>1</Overlap>
<MimeType>image/jpeg</MimeType>
<Scale />
</ImageInfo>
</NewDataSet>
But I want the xml to be generated in the following format
<data>
<Columns>
<Column Name= "ImageID"/>
<Column Name= "ImageName"/>
<Column Name= "ImagePath"/>
<Column Name= "Width"/>
<Column Name= "Height"/>
<Column Name= "TileSize"/>
<Column Name= "Overlap"/>
<Column Name= "MimeType"/>
<Column Name= "Scale"/>
</Columns>
<Rows>
<Row>
<Cell>1</Cell>
<Cell>untitled.bmp</Cell>
<Cell>Some Path</Cell>
<Cell>800</Cell>
<Cell>190</Cell>
<Cell>256</Cell>
<Cell>1</Cell>
<Cell>image/jpeg</Cell>
<Cell></Cell>
</Row>
</Rows>
</data>
this is an example with dataset having one row. there are various rows in a dataset. In my application, I wont be knowing the structure of the dataset beforehand. i.e. there can be a resulting dataset where I have more columns than the one described in the example. How should I go about this? Any help would be much appreciated.
Thanks.
|
|
|
|
|
Hello.
I'm beginning a new asp.net website (using asp.net 4.0) and I want to try implementing some better coding practices to keep the site's code "cleaner". From what I've read, updatepanel's bring along with them, a lot of unnecessary code, so my 1st plan is to avoid using them entirely.
So, I was planning on using only javascript (i.e. jQuery) to handle the same functionality of that of an upatepanel but I'm unsure of how to implement this functionality. In particular, how do I get jQuery to handle the postbacks to the server in order to communicate with asp.net server side controls?
Does anyone know of any tutorials on this in asp.net 4.0? I've been able to find older tutorials using asp.net 3.5 (which looks to be quite a bit of javascript code to handle the equivalent of an updatepanel), but wasn't sure if 4.0 implemented any more efficient approaches.
Thanks.
|
|
|
|
|
JavaScript, or JQuery more specifically, is independent of any version or flavor of .NET, so if you find one example it should apply to all.
In this situation you don't use JQuery to do any postback. You would use JQuery to make an AJAX call to a server resources, perhaps a PageMethod, then upon return, handle any page updates necessary via the DOM.
This is one example, there are many more available.
http://encosia.com/using-jquery-to-directly-call-aspnet-ajax-page-methods/[^]
No comment
|
|
|
|
|
asp.net is not really a factor using jquery, unless you populate a control with data, and alter the data with jquery, and then try to post it back to the server. Asp.net will think that the page has been tampered with, and will generate an error. So of anything, you really have to know asp.net really well, in how it deals with postbacks.
So start small with pages that don't postback or forms, and move on to as you get more confident.
FYI:
I got feed up with asp.net AJAX Toolkit, and decided to stop using it, replacing it with JQuery. The journey was long, but so far after 4 months of testing, it was well worth it. I get very few complaints now, and users claim that the programs are easier to use now.
Actually now that I think about it, I did get rid of many update panels as well, but not for the reason you claimed. I got rid of them because I needed smoothness or animation to transition from 1 stage to another, while showing progress, but not in the form of a wheel, but in the animations themselves. This changed the users perception of nothing happening fast enough due to bandwidth restrictions to something is happening. So now I don't get the user pressing the button over and over.
Here is the 10th Program I wrote with your idea, no AJAX or Update panels, pure asp.net controls and Jquery. It took 2 weeks to write, but works pretty good. I think the jquery is over 5,000 lines.
[^Pure Jquery and asp.net controls from server side]
|
|
|
|
|
Thanks for the advice.
Btw, your site looks very nice. The shopping cart has a very smooth feel to it
|
|
|
|
|
Hi guys,
i need your help.. i am newbie on ASP.net.. i tried to search some of our search engine, i found some yet i hardly understand.. here's my concern. I need to create a Main Page which is allow me to Add items in my Menu.. i mean dynamic.. i can add or delete my menu list using text file as my database or whatever it is.. please help or Ms Access..
thanks,
naijeru
|
|
|
|
|
|
filename1 = "のサンプル";
Response.Clear();
Response.ContentType = "text/comma-separated-values";
Response.ContentEncoding = System.Text.Encoding.GetEncoding( 932 );
Response.AppendHeader("Content-Disposition", "filename=\"" + filename + "\"");
Response.WriteFile(filepath);
Response.Flush();
System.IO.File.Delete(filepath);
Above code is used for downloading japanese file, when using as above i am getting file downloaded but the file when it shows in file save as dialog contains some machine mixed special characters(non ascii).
expected file name is
のサンプル .xls and not like "a1/4a...."
How to over come this issue.
Hi
As i found in the forum link i used this function to convert file name but this too didnt helped me out.
public static string EncodeTwit(string txt)
{
UTF8Encoding utf8 = new UTF8Encoding();
byte[] bytes = utf8.GetBytes(txt);
char[] chars = new char[bytes.Length];
for (int index = 0; index < bytes.Length; index++)
{
chars[index] = Convert.ToChar(bytes[index]);
}
string s = new string(chars);
return s;
}
|
|
|
|
|
Any 1 got solution for this error?
File or assembly name CrystalKeyCodeLib, or one of its dependencies, was not found.
Currently I try to deploy a system to 64bit machine..the system looks fine except for the crystal report. I'm using cystal report version Version=9.1.5000.0.
I've googled and found some suggestion but it also cant help me..The crystal report already installed..any1 have idea for this issue?need your help ASAP.
|
|
|
|
|
|
So mean that I need to create deployment package and install it for each user's PC..Is it problem cause by 64bit machine? Because crystal report did not support some of 64bit machine? How about If I try to add merge modules into the project?
|
|
|
|
|
Is that web application right? If yes then you don't need to install for every user PC. All you need is just install the things in Server machine, that's all.
|
|
|
|
|
Yup..this is web application..nvm I already issue this to my software engineer..ask him to install the correct windows version..I still did not understand y he install image windows 64bit on 32 bit machine..zzzz..thanks for your reply..=)
|
|
|
|
|
how to connect sqlserver to asp.net mobile framework or AMF please tell me....
|
|
|
|
|
guys;
I am targeting an image/jpeg response to an iframe. but its displayed in unexpected padding
in IE its displayed with padding, but not in chrome, is there anyway i can control this?
Help people,so poeple can help you.
|
|
|
|
|
|
Sir, i added style="padding:0px; margin:0px;" to the iframe tag but it doesn't work.
Help people,so poeple can help you.
|
|
|
|
|
|
How to add Group wise latest discussion Linking plugin to web site
|
|
|
|
|
Hello,
in my app I heave three roles: "admin", "user" and "company". The user can heave only one role. I want that after checking the database redirect them to certain pages - more precisely their content panel. How to specify the page to redirect for each user when it is not contained in:
FormsAuthentication.RedirectFromLoginPage(userName,createPersistantCookie);
or
FormsAuthenticationUtil.RedirectFromLoginPage(userName, commaSeperatedRoles, createPersistantCookie);
I know it is specified in web.config as default and it works for your site, but, the problem is that when I type in the URL to directly access the "admin"'s content panel (admin\default.aspx) and then try to login as "user" it does not directs me to the "user"'s content panel (user\default.aspx) but it remembers the "admin"'s one (admin\default.aspx) and redirects me to login.aspx which is NOT correct. The user exists and it should redirecting me to the default user's page.
What you suggest about this?
|
|
|
|
|
It probably wrote the value to a cookie, and saved the group setting. So Admin is always admin once the cookie is wrote.
FormsAuthentication.RedirectFromLoginPage(userName,createPersistantCookie);
Perhaps if you set coookie to FALSE, or change your code to update the group when changed, you'll get the desired behavior.
|
|
|
|
|
I have a site with a page whose url is like: http://localhost:2324/Page2
When the back button of browser is pressed the url changes to http://localhost:2324/Page1
However, the browser still shows contents of page2. Obviously if I press refresh then the browser refreshes the page.
Any ideas?
CodingYoshi
Artificial Intelligence is no match for Human Stupidity.
|
|
|
|
|
You have to fix the error in your URL map. Since Page2 did not have an extension, then it must be a mapped value to lets say page2.aspx. You as a programmer control the mappings (page2) that are sent to IIS Server for reverse mapping back to a page2.aspx?value=1, using your map as reference.
It is in my opinion that your trying to do too much at once. The implementation of query strings plus learning how to program or structure url mappings for IIS Server seems to be confusing you.
You may want to consider creating a paper map, like a visio diagram that holds the data structure of your program, so you can confirm that every possible scenario works first on paper in query strings, and then create your url map according to your Visio.
|
|
|
|
|
I have a site with these views: Categories > Products for Category X > Product Details for Product X > Confirmation Page
The first view has a bunch of categories and each has a link such as below:
http://localhost:39532/Product/List?CategoryId=94fc667e-6fec-4f76-a83b-7840df34e373&pubGuid=a6883116-560f-43e9-9ceb-7fc0a410b210&page=1&totalCount=30
When users click this it will show the 2nd view's page 1 with 10 products (paging). I am passing totalCount since I already know it in the first view and I don't want the server to have to get it again and I cannot store it in sessions or cookies. Requirements are:
Users should be able to email this url and someone else should be able to copy paste and it should work.
The Products for Category X page will have 10 products and each product will have a link for more details. The link will be like below:
http://localhost:39532/Product/Info?productId=0f0c1207-e002-4430-ae10-2ee533516b2f&CategoryId=94fc667e-6fec-4f76-a83b-7840df34e373&addedToShoppingCart=False
Users can click this link to view further details, add/remove to shopping cart based on the value. The questions I have are:
When the user adds the product to shopping list it will go to a confirmation page where they can view shopping cart or continue browsing. If they click continue browsing it should go to the product list page they were on which in this case is:
http://localhost:39532/Product/List?CategoryId=94fc667e-6fec-4f76-a83b-7840df34e373&pubGuid=a6883116-560f-43e9-9ceb-7fc0a410b210&page=1&totalCount=30
But how will the confirmation page know this info? Do I need to pass it into the ProductController.ProductDetail action which will then pass it to Confirmation.Confirm action? Now my actions will have parameters which are only to be passed onto some other view.
Let me know if my question does not make sense.
CodingYoshi
Artificial Intelligence is no match for Human Stupidity.
|
|
|
|
|
You have to capture the last url and store the value in the confirmation page.
|
|
|
|