Showing posts with label file. Show all posts
Showing posts with label file. Show all posts

Saturday, March 31, 2012

subset of data using dataview?

Dear sir,

New to ASP.NET, help will be appreciated.

I need to create a XML file for product feed. In our business, one product
always belongs to more than 1 categories. I need to have a XML file like.
<product id = "105">
<Name>whatever</Name>
<Categories>
<Category name = "Category1"/>
<Category name = "Category2"/>
....
</Categories>
</product
I can use a dataset which get the data from product table. However, my
question is that how can I get a sub set data of category. The category
rows varies depends on the product id. I am thinking to use dataview filter.
The following is my code.
......
dvCategory = New DataView(dtCategory)
strView = "ProductId='"&r("ProductId")&"'"
dvCategory.RowFilter= strView
For Each rCat in dvCategory.Table.Rows
Writer.WriteStartElement("category")
Writer.WriteAttributeString("name",
rCat("CatName")&r("ProductId"))
Writer.WriteEndElement()
Next
...

It will write out all the categories instead of only those categories this
product belongs to. Any idea what did I do wrong or how can I achieve this??

Thanks in advanced.

Guoqi Zheng
Tel: 0031-23-5343545
http://www.meetholland.comThis is because you are still grabbing all the rows from the underlying
table. The underlying table never changes, but the dataview can filter which
rows you see.

You should be looking at the Item property of the DataView to get each row
as filtered from the dataview instead.

"Guoqi Zheng" <no@.sorry.com> wrote in message
news:ulC57xn3DHA.1428@.TK2MSFTNGP12.phx.gbl...
> Dear sir,
> New to ASP.NET, help will be appreciated.
> I need to create a XML file for product feed. In our business, one product
> always belongs to more than 1 categories. I need to have a XML file like.
> <product id = "105">
> <Name>whatever</Name>
> <Categories>
> <Category name = "Category1"/>
> <Category name = "Category2"/>
> ....
> </Categories>
> </product>
> I can use a dataset which get the data from product table. However, my
> question is that how can I get a sub set data of category. The category
> rows varies depends on the product id. I am thinking to use dataview
filter.
> The following is my code.
> ......
> dvCategory = New DataView(dtCategory)
> strView = "ProductId='"&r("ProductId")&"'"
> dvCategory.RowFilter= strView
> For Each rCat in dvCategory.Table.Rows
> Writer.WriteStartElement("category")
> Writer.WriteAttributeString("name",
> rCat("CatName")&r("ProductId"))
> Writer.WriteEndElement()
> Next
> ...
> It will write out all the categories instead of only those categories this
> product belongs to. Any idea what did I do wrong or how can I achieve
this??
> Thanks in advanced.
> Guoqi Zheng
> Tel: 0031-23-5343545
> http://www.meetholland.com
Hi,

> For Each rCat in dvCategory.Table.Rows
> Writer.WriteStartElement("category")
> Writer.WriteAttributeString("name",
> rCat("CatName")&r("ProductId"))
> Writer.WriteEndElement()
> Next
> ...
> It will write out all the categories instead of only those categories this
> product belongs to. Any idea what did I do wrong or how can I achieve
this??

You should loop through DataView' DataRowView:
foreach (DataRowView drv in dv)

Write...(drv["name"]);

--
Miha Markic - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com

Wednesday, March 28, 2012

Such an easy question

VS 2005 issue

Hi I have a batch file I would like to run - once I kick off a build event for a class library

If you look in project -> properties -> Compile -> Build Events

you can enter commands in 2 windows - pre build and post build

I entered

call S:\Securinfo.NET\Atlantis Release\slnAuthManager.root\slnAuthManager\Business Logic\bllAuthManager\inc.bat

And now all I get is exited with code 1

Any ideas people - please !!!

If you go to the bin (or bin\debug) directory after building the solution, you will see the bat file that Visual Studio creates from your build event.

Open a command line, navigate to that folder, and then type the bat file name at the prompt and it will execute. Any errors should display on the screen.

Monday, March 26, 2012

suggest multi-file upload components?

I'm looking for some options for implementing a file uploading tool. The
'catch' is that it's been requested that we accomodate files from 2 to 100mb
in size, and, ideally, the ability to upload up to 20 files at a time.

I've been looking around a bit and it seems as if element-it.com's products
will work:

http://www.element-it.com/
They appear to have a file upload script that gets around some of the large
file issues that the default asp.net file upload classes have in addition to
a nice Flash-based component that allows one to browser to multiple files at
once.

Has anyone used this product? comments? Suggestions for other components to
look at?

-DarrelOn Wed, 27 Dec 2006 14:44:47 -0600, darrel wrote:

Quote:

Originally Posted by

I'm looking for some options for implementing a file uploading tool. The
'catch' is that it's been requested that we accomodate files from 2 to 100mb
in size, and, ideally, the ability to upload up to 20 files at a time.
>
I've been looking around a bit and it seems as if element-it.com's products
will work:
>
http://www.element-it.com/
>
They appear to have a file upload script that gets around some of the large
file issues that the default asp.net file upload classes have in addition to
a nice Flash-based component that allows one to browser to multiple files at
once.
>
Has anyone used this product? comments? Suggestions for other components to
look at?
>
-Darrel


If you're uploading such large files, have you considered using FTP rather
than HTTP uploads?

--
Bits.Bytes
http://bytes.thinkersroom.com
If you're uploading such large files, have you considered using FTP rather

Quote:

Originally Posted by

than HTTP uploads?


That's what they have now. It's a printer that accepts files via FTP.

However, they want to have a 'web based interface' for ease of use with
their customers

-Darrel
Hi,
If you want a ready component then Jupload is very good for your
requirement.

Thanks,
Nis
darrel wrote:

Quote:

Originally Posted by

Quote:

Originally Posted by

If you're uploading such large files, have you considered using FTP rather
than HTTP uploads?


>
That's what they have now. It's a printer that accepts files via FTP.
>
However, they want to have a 'web based interface' for ease of use with
their customers
>
-Darrel


Hi Darrel,
I suggest you http://www.jupload.biz/
Thanks,
Nis
darrel wrote:

Quote:

Originally Posted by

Quote:

Originally Posted by

Hi,
If you want a ready component then Jupload is very good for your
requirement.


>
It appears that there are multiple products using that name. Which one do
you recommend?
>
http://www.aspupload.com/jupload.html
http://sourceforge.net/projects/jupload/
http://www.jupload.biz/
others?
>
-Darrel


Hi,

Quote:

Originally Posted by

If you want a ready component then Jupload is very good for your
requirement.


It appears that there are multiple products using that name. Which one do
you recommend?

http://www.aspupload.com/jupload.html
http://sourceforge.net/projects/jupload/
http://www.jupload.biz/
others?

-Darrel

Suggestion regarding Top/footer includes

Hello,

I have the following situation. On all of my pages I would like to include a top and footer ascx file. Therefore I created two user controls. Now the the top.ascx contains another usercontrol which is a menu and shown in a table and each link in that menu is seperated with a line break. Somethin like this:

link1
link2
link3
...

Now this menu is in a table. The table looks like this:

<table width="100%">
<tbody>
<tr valign="top">
<td width="15%">
MENU HERE
</td>
<td>
CONTENT WILL BE HERE
</td>
</tr>
</tbody>
</table
Now I need to get rid of everything what comes after the MENU HERE <TD>, because this will be used for my main content. and the table will be closed then in the footer. However webmatrix always adds the missing html tags and therefore my table always looks like shown above. I hope that you guys understand what I mean. Is there anything I can do or is this is the wrong way?

ThanksI recommend that you use MasterPages, where you place the footer/header in that template.

Regards.
Arent MasterPages only in 2.0? I am using 1.1.
Nop, try to download this forum code and see how master pages are being used.

regards.
Thanks haider_balal,

I can imagine that the code for this forum is complicated and that it contains a lot of stuff. Isnt there an easier article which explains master pages in 1.1?
Hello, try to check this and give me your opinion:

MasterPages Templating Framework

regards.
2.0 will be so much fun
Why wait till asp.net 2.0 ? We can still use it in 1.1 !!!!!

regards.

Saturday, March 24, 2012

Sum of XML data

I am reading an XML file and writing its contents to a Repeater control using the following code:

Dim dstTS As DataSet

dstTS = New DataSet()
dstTS.ReadXml( MapPath( "cw052004.xml" ) )

rptTS.DataSource = dstTS
rptTS.DataBind()

It works fine. However, I would also like to calculate the sum of a the "item_cost" from each node in the XML file and place it in a variable.

Can anybody suggest the best way to go about this?do some searching for examples on the itemdatabound event. this is fired everytime an item is bound and you can use this to sum up your grids and such.
Awesome, thanks!

Summary Tags in reference.cs

Anyone know how to make my web services add summary tags to the reference.cs file VS makes when the web service is referenced?You'll have to add that yourself each time you reference the web service, as that CS file is a proxy file generated for you.
You'll have to add that yourself each time you reference the web service, as that CS file is a proxy file generated for you.
But I'm writing the web service, I want intellisense to work on client's machines when they develop solutions that use my web service. So they will need <summary> tags in reference.cs.
I know I can have Description lines in the wsdl file, but it is not the easiest thing to read.
Guess MS & W3 haven't thought it out yet.

Tuesday, March 13, 2012

switch connection string in xsd file

Hi,

I have 2 connectionstrings in the web.config file in my website. It has a xsd file of handling all the database calls etc.

I wonder how do I switch the connectionstring used in the xsd file in code-behind?

Basically, my web.config will have a setting indicates whether website is test mode or live mode in appSetting region:

<add key="mode" value="">

So:

<add key="mode" value="test"> <!--is testing mode-->

<add key="mode" value="live"> <!--is live mode-->

depend on this than the whole site is using the appropriate connection string, sample code:

public static string ConnectionString
{
get
{
if (IsTesting)
{
return ConfigurationManager.ConnectionStrings["Test"].ToString();
}
else
{
return ConfigurationManager.ConnectionStrings["Live"].ToString();
}
}
}

But how to you set the xsd file following this rule?

Thanks in advance.

Hi,

As far as I can see, we don't use .xsd file to switch this. From your code, I can see that your ConfigurationManager is reading from web.config for the targeted connectionstring directly. So the only thing we need to do is to set the IsTesting flag. I think you can add a new key in Web.Config to indicate if the testing mode is true or false.

Switch from Cassini to IIS on a project

I was dumb and created the project as FILE instead of HTTP. I have IIS installed and want to use it instead. How can I switch my project over, or do I have to recreate it and readd my items?

- Right click on the root node of the Solution Explorer

- Goto "Options"

- In the "Server" area, say "Use Custom Server" and set the "Base URL"

done


never mind... found it

START options... :}

switch project from "file" to "web"?

I've taken over a project from another for a webservice. He originally set it up as "file" based, so it's showing up as "c:\path\to\site" in the solution manager. This is causing issues and it should be setup as a website withhttp://virtual/to/site.

Is there a way to switch a file based one to a web based one and have it use IIS ?

Nevermind... just readded it manually to the solution, seemed to work

Hi:

I think you are talking about an ASP.NET 2.0 application?

You can simply make a File System application work smoothly with IIS, by creating a new website poiting to the folder of that application, and open a web path in VS 2005 instead of the File System

Am I getting you correct?

Regards


yes, the issue was that it was under source control...

It's all good now though, thank you.


Hi Curt, I am glad it worked fine now.

Take care my friend,

Regards