Showing posts with label newbie. Show all posts
Showing posts with label newbie. Show all posts

Thursday, March 29, 2012

newbie: Help, I have problems with this!

hey
asp.net 2.0
visual web developer 2005 express
I have a webpage which contains 1 Repeater control. Into this repeater
control I want to add several rows of data. My problem is that 1 of the data
is an array of bytes (it's a picture saved to the database as bytes) and I
want that picture to be displayed nicely in the repeater list...
Here is two approaches (approach A and approach B) I'm trying:
APPROACH A:
Use the scenario of 2 .aspx files, 1 .aspx (A) convert the bytes of array
into a picture and the other .aspx file (B) has a img tag pointing to the
first .aspx file (A)
But here I get problems with this line "img.Src =
"Thumnail.aspx?ImageID=1";", it looks like it expects a object... Somehow I
need to send over a parameter to this Thumbnail.aspx file about which image
to display... Lets say the resultset has many images, but this row shall
display one particular image
protected void rptInbox_ItemDataBound(object sender, RepeaterItemEventArgs
e)
{
System.Web.UI.HtmlControls.HtmlImage img = null;
if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType ==
ListItemType.AlternatingItem)) {
img =
(System.Web.UI.HtmlControls.HtmlImage)e.Item.FindControl("Photo");
img.Src = "Thumnail.aspx?ImageID=1";
}
}
<%@dotnet.itags.org. Page Language="C#" MasterPageFile="~/MasterPage.master"
AutoEventWireup="true" CodeFile="inbox.aspx.cs"
Inherits="webForms_Profile_inbox" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="content" Runat="Server">
<asp:ObjectDataSource ID="odsInbox" runat="server"
SelectMethod="getInbox" TypeName="BusinessLogic.NetworkLogic">
</asp:ObjectDataSource>
<asp:Repeater ID="rptInbox" runat="server" DataSourceID="odsInbox"
OnItemDataBound="rptInbox_ItemDataBound">
<ItemTemplate>
<tr>
<td bgcolor="#CCFFCC">
<%# Eval("Name") %>
<img ID="Photo" src="http://pics.10026.com/?src=" />
</td>
</tr>
</ItemTemplate>
</asp:Repeater>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="sidebar" Runat="Server">
</asp:Content>
****************************************
************************
APPROACH B:
In this approach I tryed to replace the img tag with a Image control in the
repeater.
But the "System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(mstream);"
gives this error:
"Parameter is not valid."
Another thing is that I'm not sure this is a good approach because it uses
bmp.Save() and I'm afraid the server will run out of space if images get
saved on the server each time th page is displayed?
protected void rptInbox_ItemDataBound(object sender, RepeaterItemEventArgs
e)
{
//System.Web.UI.HtmlControls.HtmlImage img = null;
System.Web.UI.WebControls.Image img = null;
if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType ==
ListItemType.AlternatingItem)) {
img =
(System.Web.UI.WebControls.Image)e.Item.FindControl("Photo");
byte[] data = Profile.Picture;
Int32 offset = 78;
System.IO.MemoryStream mstream = new System.IO.MemoryStream();
mstream.Write(data, offset, data.Length - offset);
System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(mstream);
bmp.Save(Server.MapPath("sample.jpeg"),
System.Drawing.Imaging.ImageFormat.Jpeg);
mstream.Close();
img.ImageUrl = Server.MapPath("sample.jpeg");
}
//e.Item.DataItem.ToString();
}
Please help me with this one, I'm stucked in this problem...
Best Regards
Jeffhi Jeff
I think I've covered this in a previous thread, but anyways
on this page is an example of dynamically displaying binary image data
on a Web page. this uses a GridView but the logic's the same
http://authors.aspalliance.com/aspx...classbinarywri=
te.aspx
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D
Reynald V. Nu=F1ez
http://authors.aspalliance.com/aspxtreme

newbie: Help, I have problems with this!

hey

asp.net 2.0
visual web developer 2005 express

I have a webpage which contains 1 Repeater control. Into this repeater
control I want to add several rows of data. My problem is that 1 of the data
is an array of bytes (it's a picture saved to the database as bytes) and I
want that picture to be displayed nicely in the repeater list...

Here is two approaches (approach A and approach B) I'm trying:

APPROACH A:
Use the scenario of 2 .aspx files, 1 .aspx (A) convert the bytes of array
into a picture and the other .aspx file (B) has a img tag pointing to the
first .aspx file (A)

But here I get problems with this line "img.Src =
"Thumnail.aspx?ImageID=1";", it looks like it expects a object... Somehow I
need to send over a parameter to this Thumbnail.aspx file about which image
to display... Lets say the resultset has many images, but this row shall
display one particular image

protected void rptInbox_ItemDataBound(object sender, RepeaterItemEventArgs
e)
{
System.Web.UI.HtmlControls.HtmlImage img = null;
if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType ==
ListItemType.AlternatingItem)) {
img =
(System.Web.UI.HtmlControls.HtmlImage)e.Item.FindC ontrol("Photo");
img.Src = "Thumnail.aspx?ImageID=1";
}
}

<%@dotnet.itags.org. Page Language="C#" MasterPageFile="~/MasterPage.master"
AutoEventWireup="true" CodeFile="inbox.aspx.cs"
Inherits="webForms_Profile_inbox" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="content" Runat="Server">
<asp:ObjectDataSource ID="odsInbox" runat="server"
SelectMethod="getInbox" TypeName="BusinessLogic.NetworkLogic">
</asp:ObjectDataSource>
<asp:Repeater ID="rptInbox" runat="server" DataSourceID="odsInbox"
OnItemDataBound="rptInbox_ItemDataBound">
<ItemTemplate>
<tr>
<td bgcolor="#CCFFCC">
<%# Eval("Name") %>
<img ID="Photo" src="http://pics.10026.com/?src=" />
</td>
</tr>
</ItemTemplate>

</asp:Repeater>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="sidebar" Runat="Server">
</asp:Content>

************************************************** **************
APPROACH B:

In this approach I tryed to replace the img tag with a Image control in the
repeater.
But the "System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(mstream);"
gives this error:
"Parameter is not valid."

Another thing is that I'm not sure this is a good approach because it uses
bmp.Save() and I'm afraid the server will run out of space if images get
saved on the server each time th page is displayed?

protected void rptInbox_ItemDataBound(object sender, RepeaterItemEventArgs
e)
{
//System.Web.UI.HtmlControls.HtmlImage img = null;
System.Web.UI.WebControls.Image img = null;

if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType ==
ListItemType.AlternatingItem)) {
img =
(System.Web.UI.WebControls.Image)e.Item.FindContro l("Photo");
byte[] data = Profile.Picture;

Int32 offset = 78;
System.IO.MemoryStream mstream = new System.IO.MemoryStream();
mstream.Write(data, offset, data.Length - offset);
System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(mstream);

bmp.Save(Server.MapPath("sample.jpeg"),
System.Drawing.Imaging.ImageFormat.Jpeg);
mstream.Close();
img.ImageUrl = Server.MapPath("sample.jpeg");

}

//e.Item.DataItem.ToString();
}

Please help me with this one, I'm stucked in this problem...

Best Regards

Jeffhi Jeff

I think I've covered this in a previous thread, but anyways

on this page is an example of dynamically displaying binary image data
on a Web page. this uses a GridView but the logic's the same

http://authors.aspalliance.com/aspx...inarywrite.aspx
==============================
Reynald V. Nuez
http://authors.aspalliance.com/aspxtreme

Newbie: How do I install a control in order to use it?

I am new to asp.net and want to use a control. How do I install it or waht do I need to do to use it?

JosenAre you talking about a 3rd party control?
Yes. I want to use the control at the following link...

http://scottonwriting.net/demos/RoundedCorners.aspx
It really depends on your editor - -
if you're using VS.Net - you right click on the tools section and add the new control into your project.

If you're just using a text editor - copy the dll you download, into your bin directory and inside your aspx page - just use the markup they have on that page and change the appearance the way you need.
That's what I was looking for...

Thanks,

Josen
Oh... what's the full path to the bin directory?
The bin folder is placed in the root directory of your website.
your bin directory should be at the root of your web application.

/bin/
Rounded corners is pretty sweet, I started using it the past few days.

You can also open windows explorer and find the .dll and drag it onto your vs.net toolbox.

Newbie: How do I create Dynamic instrument widgets in ASP.NET

Hello,
I want to create a dynamic web page, which presents various instrument
widgets (Temperatures, pressures, rpm gauges, speeds etc.) in a
browser, with continous data updates from Server side data. Obviously
these instruments need to be constantly refreshed (every 0.5 second or
so) and not just on page load.
With Windows Forms, and GDI I can do this with networked Thick Client
code. I can also do dynamic web instruments with Java Applets, and I
guess DHTML/Javascript. But I really want to do the instruments in C#
and .NET. But I don't think that I can achieve this, because http and
ASP.NET is based upon a page based paradigm. The new ASP.NEt is based
upon Server side controls, that won't refresh my instruments with live
data, once the page is downloaded. (Traditional DHTML/Javascript looks
like a real pain to develop instruments in.)
I am agreat fan of .NET technologies, but I was hoping for better MS
and .NET support for these instrument based web applications. But I
guess my only real choice is Java Applets !
Any suggestions on how I can achieve dynamic web instruments with .NET
technology would be appreciated.
Thanks
JulesThere may well be other ways of acheiving this kind of thing, but you could
just refresh the image (in JS) representing the clock
or you could use the WebBehaviour stuff, this will allow you to connect to a
webservice on the server (using JS again) then you can update your clock or
gauge or whatever in the JS on the client.
"Jules" <Roseanna80@.hotmail.com> wrote in message
news:80bc211e.0503310335.15a8c492@.posting.google.com...
> Hello,
> I want to create a dynamic web page, which presents various instrument
> widgets (Temperatures, pressures, rpm gauges, speeds etc.) in a
> browser, with continous data updates from Server side data. Obviously
> these instruments need to be constantly refreshed (every 0.5 second or
> so) and not just on page load.
> With Windows Forms, and GDI I can do this with networked Thick Client
> code. I can also do dynamic web instruments with Java Applets, and I
> guess DHTML/Javascript. But I really want to do the instruments in C#
> and .NET. But I don't think that I can achieve this, because http and
> ASP.NET is based upon a page based paradigm. The new ASP.NEt is based
> upon Server side controls, that won't refresh my instruments with live
> data, once the page is downloaded. (Traditional DHTML/Javascript looks
> like a real pain to develop instruments in.)
> I am agreat fan of .NET technologies, but I was hoping for better MS
> and .NET support for these instrument based web applications. But I
> guess my only real choice is Java Applets !
> Any suggestions on how I can achieve dynamic web instruments with .NET
> technology would be appreciated.
> Thanks
> Jules
I'd say your requirements don't lend themselves to building a browser based
application. Consider building a traditional fat client app using ClickOnce
or NoTouch Deployment. A java applet is really no different.
-Brock
DevelopMentor
http://staff.develop.com/ballen

> Hello,
> I want to create a dynamic web page, which presents various instrument
> widgets (Temperatures, pressures, rpm gauges, speeds etc.) in a
> browser, with continous data updates from Server side data. Obviously
> these instruments need to be constantly refreshed (every 0.5 second or
> so) and not just on page load.
> With Windows Forms, and GDI I can do this with networked Thick Client
> code. I can also do dynamic web instruments with Java Applets, and I
> guess DHTML/Javascript. But I really want to do the instruments in C#
> and .NET. But I don't think that I can achieve this, because http and
> ASP.NET is based upon a page based paradigm. The new ASP.NEt is based
> upon Server side controls, that won't refresh my instruments with live
> data, once the page is downloaded. (Traditional DHTML/Javascript looks
> like a real pain to develop instruments in.)
> I am agreat fan of .NET technologies, but I was hoping for better MS
> and .NET support for these instrument based web applications. But I
> guess my only real choice is Java Applets !
> Any suggestions on how I can achieve dynamic web instruments with .NET
> technology would be appreciated.
> Thanks
> Jules
>

Newbie: How do I create Dynamic instrument widgets in ASP.NET

Hello,

I want to create a dynamic web page, which presents various instrument
widgets (Temperatures, pressures, rpm gauges, speeds etc.) in a
browser, with continous data updates from Server side data. Obviously
these instruments need to be constantly refreshed (every 0.5 second or
so) and not just on page load.

With Windows Forms, and GDI I can do this with networked Thick Client
code. I can also do dynamic web instruments with Java Applets, and I
guess DHTML/Javascript. But I really want to do the instruments in C#
and .NET. But I don't think that I can achieve this, because http and
ASP.NET is based upon a page based paradigm. The new ASP.NEt is based
upon Server side controls, that won't refresh my instruments with live
data, once the page is downloaded. (Traditional DHTML/Javascript looks
like a real pain to develop instruments in.)

I am agreat fan of .NET technologies, but I was hoping for better MS
and .NET support for these instrument based web applications. But I
guess my only real choice is Java Applets !

Any suggestions on how I can achieve dynamic web instruments with .NET
technology would be appreciated.

Thanks

JulesThere may well be other ways of acheiving this kind of thing, but you could
just refresh the image (in JS) representing the clock

or you could use the WebBehaviour stuff, this will allow you to connect to a
webservice on the server (using JS again) then you can update your clock or
gauge or whatever in the JS on the client.

"Jules" <Roseanna80@.hotmail.com> wrote in message
news:80bc211e.0503310335.15a8c492@.posting.google.c om...
> Hello,
> I want to create a dynamic web page, which presents various instrument
> widgets (Temperatures, pressures, rpm gauges, speeds etc.) in a
> browser, with continous data updates from Server side data. Obviously
> these instruments need to be constantly refreshed (every 0.5 second or
> so) and not just on page load.
> With Windows Forms, and GDI I can do this with networked Thick Client
> code. I can also do dynamic web instruments with Java Applets, and I
> guess DHTML/Javascript. But I really want to do the instruments in C#
> and .NET. But I don't think that I can achieve this, because http and
> ASP.NET is based upon a page based paradigm. The new ASP.NEt is based
> upon Server side controls, that won't refresh my instruments with live
> data, once the page is downloaded. (Traditional DHTML/Javascript looks
> like a real pain to develop instruments in.)
> I am agreat fan of .NET technologies, but I was hoping for better MS
> and .NET support for these instrument based web applications. But I
> guess my only real choice is Java Applets !
> Any suggestions on how I can achieve dynamic web instruments with .NET
> technology would be appreciated.
> Thanks
> Jules
I'd say your requirements don't lend themselves to building a browser based
application. Consider building a traditional fat client app using ClickOnce
or NoTouch Deployment. A java applet is really no different.

-Brock
DevelopMentor
http://staff.develop.com/ballen

> Hello,
> I want to create a dynamic web page, which presents various instrument
> widgets (Temperatures, pressures, rpm gauges, speeds etc.) in a
> browser, with continous data updates from Server side data. Obviously
> these instruments need to be constantly refreshed (every 0.5 second or
> so) and not just on page load.
> With Windows Forms, and GDI I can do this with networked Thick Client
> code. I can also do dynamic web instruments with Java Applets, and I
> guess DHTML/Javascript. But I really want to do the instruments in C#
> and .NET. But I don't think that I can achieve this, because http and
> ASP.NET is based upon a page based paradigm. The new ASP.NEt is based
> upon Server side controls, that won't refresh my instruments with live
> data, once the page is downloaded. (Traditional DHTML/Javascript looks
> like a real pain to develop instruments in.)
> I am agreat fan of .NET technologies, but I was hoping for better MS
> and .NET support for these instrument based web applications. But I
> guess my only real choice is Java Applets !
> Any suggestions on how I can achieve dynamic web instruments with .NET
> technology would be appreciated.
> Thanks
> Jules

newbie: How do I add a project....

Hey

visual studio 2005

I have a asp.net 2.0 project and a class library project. Both projects
created in visual studio 2005. I want to add the class library project to
the asp.net 2.0 project.

I want to add the library project so that I can reference the project,
instead of the compiled file...

I've already tryed to using the "Add Existing Item..." window in the asp.net
2.0 project, which only added the file I selected (.sln file). I don't think
this is the correct way of doing it...

Any suggestions?

JeffHi Jeff,

File->Open Project/Solution and remember to mark Add to solution instead
of Close solution.

On Thu, 14 Sep 2006 12:06:10 +0200, Jeff
<it_consultant1@.hotmail.com.NOSPAMwrote:

Quote:

Originally Posted by

Hey
>
visual studio 2005
>
I have a asp.net 2.0 project and a class library project. Both projects
created in visual studio 2005. I want to add the class library project to
the asp.net 2.0 project.
>
I want to add the library project so that I can reference the project,
instead of the compiled file...
>
I've already tryed to using the "Add Existing Item..." window in the
asp.net
2.0 project, which only added the file I selected (.sln file). I don't
think
this is the correct way of doing it...
>
Any suggestions?
>
Jeff
>
>


--
Happy Coding!
Morten Wennevik [C# MVP]
thanks

"Morten Wennevik" <MortenWennevik@.hotmail.comwrote in message
news:op.tfu46bz6klbvpo@.tr024.bouvet.no...

Quote:

Originally Posted by

Hi Jeff,
>
File->Open Project/Solution and remember to mark Add to solution instead
of Close solution.
>
>
>
On Thu, 14 Sep 2006 12:06:10 +0200, Jeff
<it_consultant1@.hotmail.com.NOSPAMwrote:
>

Quote:

Originally Posted by

>Hey
>>
>visual studio 2005
>>
>I have a asp.net 2.0 project and a class library project. Both projects
>created in visual studio 2005. I want to add the class library project to
>the asp.net 2.0 project.
>>
>I want to add the library project so that I can reference the project,
>instead of the compiled file...
>>
>I've already tryed to using the "Add Existing Item..." window in the
>asp.net
>2.0 project, which only added the file I selected (.sln file). I don't
>think
>this is the correct way of doing it...
>>
>Any suggestions?
>>
>Jeff
>>
>>


>
>
>
--
Happy Coding!
Morten Wennevik [C# MVP]

newbie: how do I? <export table to sql script>

Hey

I've created a simple asp.net 2.0 (visual studio 2005) project containing a
database in the App_Data folder

I wonder how I can export individual tables from this database to sql
script...

Any suggestions?

JeffOkay, I've sold this by using Sql Express 2005 Managment Tool

"Jeff" <it_consultant1@.hotmail.com.NOSPAMwrote in message
news:%23EHhcDF%23GHA.4696@.TK2MSFTNGP05.phx.gbl...

Quote:

Originally Posted by

Hey
>
I've created a simple asp.net 2.0 (visual studio 2005) project containing
a database in the App_Data folder
>
I wonder how I can export individual tables from this database to sql
script...
>
Any suggestions?
>
Jeff
>


I mean solved it... :-)

"Jeff" <it_consultant1@.hotmail.com.NOSPAMwrote in message
news:%23TnApCG%23GHA.748@.TK2MSFTNGP02.phx.gbl...

Quote:

Originally Posted by

Okay, I've sold this by using Sql Express 2005 Managment Tool
>
"Jeff" <it_consultant1@.hotmail.com.NOSPAMwrote in message
news:%23EHhcDF%23GHA.4696@.TK2MSFTNGP05.phx.gbl...

Quote:

Originally Posted by

>Hey
>>
>I've created a simple asp.net 2.0 (visual studio 2005) project containing
>a database in the App_Data folder
>>
>I wonder how I can export individual tables from this database to sql
>script...
>>
>Any suggestions?
>>
>Jeff
>>


>
>

newbie: how do I? <export table to sql script>

Hey
I've created a simple asp.net 2.0 (visual studio 2005) project containing a
database in the App_Data folder
I wonder how I can export individual tables from this database to sql
script...
Any suggestions?
JeffOkay, I've sold this by using Sql Express 2005 Managment Tool
"Jeff" <it_consultant1@.hotmail.com.NOSPAM> wrote in message
news:%23EHhcDF%23GHA.4696@.TK2MSFTNGP05.phx.gbl...
> Hey
> I've created a simple asp.net 2.0 (visual studio 2005) project containing
> a database in the App_Data folder
> I wonder how I can export individual tables from this database to sql
> script...
> Any suggestions?
> Jeff
>
I mean solved it... :-)
"Jeff" <it_consultant1@.hotmail.com.NOSPAM> wrote in message
news:%23TnApCG%23GHA.748@.TK2MSFTNGP02.phx.gbl...
> Okay, I've sold this by using Sql Express 2005 Managment Tool
> "Jeff" <it_consultant1@.hotmail.com.NOSPAM> wrote in message
> news:%23EHhcDF%23GHA.4696@.TK2MSFTNGP05.phx.gbl...
>

Newbie: How safe is source code?

Hi

I am a complete newbie and am contemplating moving to asp.net from asp. How
protected is an asp.net web site source code should it be delivered to a
client?

Thanks

RegardsMy opinion:

If your concern is about protecting access to the code itself, then ASP.NET
source is much safer than classic ASP, because the deliverable is actually a
set of compiled .dll's, rather than a set of vbscript files.

However, you should be aware that it is notoriously easy to decompile a .NET
assembly into very clean source code. If this worries you, you should
consider using an obfuscator to "scramble" the dll code so that decompiling
either doesn't work or doesn't work very well.

-Michael

"John" <john@.nospam.infovis.co.uk> wrote in message
news:Oo1BKKIpDHA.2732@.TK2MSFTNGP11.phx.gbl...
> Hi
> I am a complete newbie and am contemplating moving to asp.net from asp.
How
> protected is an asp.net web site source code should it be delivered to a
> client?
> Thanks
> Regards
Hi John,

You should obfuscate your ASP.NET with Dotfuscator (a .NET
obfuscator).
A lite version is included inside VS.NET 2003 under the tools menu.
This will make reverse engineered code harder to understand.

If you want more protection that significantly hinders reverse
engineering by crashing or stopping decompilers and support look at
Dotfuscator Professional Edition.

For more info: www.preemptive.com/dotfuscator

Best Regards,
Dotfuscator Team

> "John" <john@.nospam.infovis.co.uk>
> > Hi
> > I am a complete newbie and am contemplating moving to asp.net from asp.
> How
> > protected is an asp.net web site source code should it be delivered to a
> > client?
I agree. But what about 'Whidbey' (new VS 2004)? I think we going
back to no code-behind'.

-----------------------
http://www.naptaxes.com/AAJ/
[AllAmericanJobs - Searching jobs from your desktop and automatically
sends resume.]
Even with 'no code behind' isn't the result still .NET code which can be decompiled?

> I agree. But what about 'Whidbey' (new VS 2004)? I think we going
> back to ?no code-behind'.

Newbie: How to compare strings?

Hi,

On my drop down list control, i am trying to set the
DropDownList1.SelectedValue property to the selected string value. In my
example, my DropDownList1 control contains three colors:

- Carlos
- Mike
- Susan

However, if i try to set the DropDownList1.SelectedValue = "carlos"; i get
the following error: "Exception: Specified argument was out of the range of
valid values. Parameter name: carlos." This is b/c "Carlos" != to "carlos".

I realize that i can convert all the drop down list controls values to
uppercase, however, i'd like to keep the names as they are entered by the
user.

Is there anyway to compare these strings, ignoring any differences in
uppercase or lowercase?

Thanks!String.Compare("CARLOS", "carlos", true);

-Brock
DevelopMentor
http://staff.develop.com/ballen

> Hi,
> On my drop down list control, i am trying to set the
> DropDownList1.SelectedValue property to the selected string value. In
> my example, my DropDownList1 control contains three colors:
> - Carlos
> - Mike
> - Susan
> However, if i try to set the DropDownList1.SelectedValue = "carlos"; i
> get the following error: "Exception: Specified argument was out of the
> range of valid values. Parameter name: carlos." This is b/c "Carlos"
> != to "carlos".
> I realize that i can convert all the drop down list controls values to
> uppercase, however, i'd like to keep the names as they are entered by
> the user.
> Is there anyway to compare these strings, ignoring any differences in
> uppercase or lowercase?
> Thanks!

Newbie: How to compare strings?

Hi,
On my drop down list control, i am trying to set the
DropDownList1.SelectedValue property to the selected string value. In my
example, my DropDownList1 control contains three colors:
- Carlos
- Mike
- Susan
However, if i try to set the DropDownList1.SelectedValue = "carlos"; i get
the following error: "Exception: Specified argument was out of the range of
valid values. Parameter name: carlos." This is b/c "Carlos" != to "carlos".
I realize that i can convert all the drop down list controls values to
uppercase, however, i'd like to keep the names as they are entered by the
user.
Is there anyway to compare these strings, ignoring any differences in
uppercase or lowercase?
Thanks!String.Compare("CARLOS", "carlos", true);
-Brock
DevelopMentor
http://staff.develop.com/ballen

> Hi,
> On my drop down list control, i am trying to set the
> DropDownList1.SelectedValue property to the selected string value. In
> my example, my DropDownList1 control contains three colors:
> - Carlos
> - Mike
> - Susan
> However, if i try to set the DropDownList1.SelectedValue = "carlos"; i
> get the following error: "Exception: Specified argument was out of the
> range of valid values. Parameter name: carlos." This is b/c "Carlos"
> != to "carlos".
> I realize that i can convert all the drop down list controls values to
> uppercase, however, i'd like to keep the names as they are entered by
> the user.
> Is there anyway to compare these strings, ignoring any differences in
> uppercase or lowercase?
> Thanks!
>

newbie: how to compare bit field from sql table to oledbdatareader?

Hi, I made a bit field off my sql table to represent true/false.
I'm having trouble to use compare the value off that table using OleDbDataReader, please help correct my code:
string connectionString = "(connect goes here)";
string sql = "SELECT isActived FROM List WHERE ID=@dotnet.itags.org.ID";
SqlConnection conn = new SqlConnection(connectionString);
SqlDataReader reader = null;
conn.Open();
SqlCommand cmd = new SqlCommand(sql,conn);
cmd.Parameters.Add("@dotnet.itags.org.license", "(my id number goes here)");
reader = cmd.ExecuteReader();
(something wrong with this code:) bool temp = reader["isActived"];
(or this:) if (
reader["isActived"] == true)
reader.Close();
conn.Close();
TIA

After a call to ExecuteRead, the reader is positioned before the first row. You must call reader.Read() to position the reader on a row before you attempt to access any data.


If you only get one value back, you may try this:
bool temp = cmd.ExecuteScalar();


thanks DMW, Jimmy, looks like ExecuteScalar would help me save a couple lines of code :)

Newbie: How to display search results?

I am new to ASP.NET, so probably my question is very basic:

I have a web page (page1) where I allow the user to make a search, text box
plus a botton (botton1).
When he click the botton (button1), the server obtain (from memory) an array
of Products Id.
I want to open a second web page (page 2) with the results (obtained from a
database using the Products Id), the results will be shown in a datagrid.

My question:
- If Once I clicked botton1 I retrieve from de database the Products (using
the array of ProductsId and a datareader) how I bound this datareader to the
datagrid in page2?.
- I think there is a second option: I pass the array (memory array) of
products Id to Page2 (how i do it?) and the Onload event of Page2 read the
data from the database and show it in the datagrid. How I pass the memory
array to Onload event of Page2?.

I am pretty new to ASP.NET so I suspect there is an standard way of doing
this, I welcome any suggestion.

Thanks,

JaimeI am new to ASP.NET, so probably my question is very basic:

Quote:

Originally Posted by

>
I have a web page (page1) where I allow the user to make a search, text box
plus a botton (botton1).
When he click the botton (button1), the server obtain (from memory) an array
of Products Id.
I want to open a second web page (page 2) with the results (obtained from a
database using the Products Id), the results will be shown in a datagrid.
>


By "open a second page", do you mean "open in a new window", or just
"replace the current page"? If new window, then see if there is a
"target" attribute on that button (button1). If current page, then
nothing special needs to be done.

Quote:

Originally Posted by

My question:
- If Once I clicked botton1 I retrieve from de database the Products (using
the array of ProductsId and a datareader) how I bound this datareader to the
datagrid in page2?.
- I think there is a second option: I pass the array (memory array) of
products Id to Page2 (how i do it?) and the Onload event of Page2 read the
data from the database and show it in the datagrid. How I pass the memory
array to Onload event of Page2?.
>
I am pretty new to ASP.NET so I suspect there is an standard way of doing
this, I welcome any suggestion.
>
Thanks,
>
Jaime


To switch from one page to another, you can use "Response.Redirect()",
using the new url as a parameter.

To pass data from one page to another, there are several options:
- querystring, like "page2.aspx?searchtext=bla". Best for a small list
of short values, that can be represented by a string.
- Session data. In page1 you store "it" in the session
(Session["productids"] = list) and in page2 you read it, casting as
required ( int[] list = (int[])Session["productids"] )

You can perform the search in page1, passing the results (via Session)
to page2. Or you can pass the searchtext to page2 (session or
querystring), where the complete search is performed. I like the second
option better, as you concentrate the "search functionality" in that
page.

Hans Kesting

Newbie: How to duplicate a webform (including code) - I'm confused.

Hi there,
I am sure there is a very simple answer to this question. But how does one
duplicate a webform in ASP.net? E.g. I have a webform that has standard
basic functionality for my whole web application (e.g. a navigation bar and
general layout). I want to copy this form many times as it is the template
for each page within my application.
However, when I use "save as" and save the webform as a different name,
things do not go as planned. Also I want all the underlying code to be
copied as well (e.g. so if I use a link button, on my first page, I want the
underlying code for that button to also copy through to the duplicate page).
So how is this achieved?
I'm probably going to be told there is a better way of having a template
page as well. This information will be useful as well, but for the time
being, duplicating manually a template page will do fine.
Kind regards
Dave.Dave, in ASP.NET 1.x, there's not a real easy way to do this. There are
Master Pages - http://aspnet.4guysfromrolla.com/articles/040704-1.aspx -
but these have poor tool support in VS.NET 2002/2003.
Fortunately this becomes much less of a pain with ASP.NET 2.0 and Visual
Studio 2005... but for the time being, it's not as easy as it *should*
be. But do check out Master Pages in ASP.NET 1.x, it's better than just
copying and pasting code around on each page...
Dave Smithz wrote:
> I am sure there is a very simple answer to this question. But how does one
> duplicate a webform in ASP.net? E.g. I have a webform that has standard
> basic functionality for my whole web application (e.g. a navigation bar an
d
> general layout). I want to copy this form many times as it is the template
> for each page within my application.
> However, when I use "save as" and save the webform as a different name,
> things do not go as planned. Also I want all the underlying code to be
> copied as well (e.g. so if I use a link button, on my first page, I want t
he
> underlying code for that button to also copy through to the duplicate page
).
> So how is this achieved?
> I'm probably going to be told there is a better way of having a template
> page as well. This information will be useful as well, but for the time
> being, duplicating manually a template page will do fine.
Scott Mitchell
mitchell@.4guysfromrolla.com
http://www.4GuysFromRolla.com
* When you think ASP.NET, think 4GuysFromRolla.com!
"Scott Mitchell [MVP]" <mitchell@.4guysfromrolla.com> wrote in message
news:h6Dfd.10379> Dave, in ASP.NET 1.x, there's not a real easy way to do
this. There are
> Master Pages - http://aspnet.4guysfromrolla.com/articles/040704-1.aspx -
> but these have poor tool support in VS.NET 2002/2003.
OK So not such a stupid question then. But now I probably have one. I've
knocked together a basic ASP.net website to show someone. But I wnat to show
them without having to run Visual Studio.net. Currently I press f5 to run
the web application, but I want to be able to just go to a URL without
having to run VS first.
How do I do this?
Kind regards
Dave
"Dave Smithz" <SPAM FREE WORLD> wrote in message
news:417fb0f2$1@.news1.homechoice.co.uk...
> "Scott Mitchell [MVP]" <mitchell@.4guysfromrolla.com> wrote in message
> news:h6Dfd.10379> Dave, in ASP.NET 1.x, there's not a real easy way to do
> this. There are
> OK So not such a stupid question then. But now I probably have one. I've
> knocked together a basic ASP.net website to show someone. But I wnat to
> show
> them without having to run Visual Studio.net. Currently I press f5 to run
> the web application, but I want to be able to just go to a URL without
> having to run VS first.
> How do I do this?
What happens if you just go to the URL?
--
John Saunders
"John Saunders" <johnwsaundersiii@.hotmail.com> wrote in message >
> What happens if you just go to the URL?
> --
> John Saunders
errrr, it seems to work now. But I tell you it didn't before! ;)
Cheers

Newbie: How to duplicate a webform (including code) - Im confused.

Hi there,

I am sure there is a very simple answer to this question. But how does one
duplicate a webform in ASP.net? E.g. I have a webform that has standard
basic functionality for my whole web application (e.g. a navigation bar and
general layout). I want to copy this form many times as it is the template
for each page within my application.
However, when I use "save as" and save the webform as a different name,
things do not go as planned. Also I want all the underlying code to be
copied as well (e.g. so if I use a link button, on my first page, I want the
underlying code for that button to also copy through to the duplicate page).

So how is this achieved?

I'm probably going to be told there is a better way of having a template
page as well. This information will be useful as well, but for the time
being, duplicating manually a template page will do fine.

Kind regards

Dave.Dave, in ASP.NET 1.x, there's not a real easy way to do this. There are
Master Pages - http://aspnet.4guysfromrolla.com/articles/040704-1.aspx -
but these have poor tool support in VS.NET 2002/2003.

Fortunately this becomes much less of a pain with ASP.NET 2.0 and Visual
Studio 2005... but for the time being, it's not as easy as it *should*
be. But do check out Master Pages in ASP.NET 1.x, it's better than just
copying and pasting code around on each page...

Dave Smithz wrote:
> I am sure there is a very simple answer to this question. But how does one
> duplicate a webform in ASP.net? E.g. I have a webform that has standard
> basic functionality for my whole web application (e.g. a navigation bar and
> general layout). I want to copy this form many times as it is the template
> for each page within my application.
> However, when I use "save as" and save the webform as a different name,
> things do not go as planned. Also I want all the underlying code to be
> copied as well (e.g. so if I use a link button, on my first page, I want the
> underlying code for that button to also copy through to the duplicate page).
> So how is this achieved?
> I'm probably going to be told there is a better way of having a template
> page as well. This information will be useful as well, but for the time
> being, duplicating manually a template page will do fine.

--

Scott Mitchell
mitchell@.4guysfromrolla.com
http://www.4GuysFromRolla.com

* When you think ASP.NET, think 4GuysFromRolla.com!
"Scott Mitchell [MVP]" <mitchell@.4guysfromrolla.com> wrote in message
news:h6Dfd.10379> Dave, in ASP.NET 1.x, there's not a real easy way to do
this. There are
> Master Pages - http://aspnet.4guysfromrolla.com/articles/040704-1.aspx -
> but these have poor tool support in VS.NET 2002/2003.

OK So not such a stupid question then. But now I probably have one. I've
knocked together a basic ASP.net website to show someone. But I wnat to show
them without having to run Visual Studio.net. Currently I press f5 to run
the web application, but I want to be able to just go to a URL without
having to run VS first.

How do I do this?

Kind regards

Dave
"John Saunders" <johnwsaundersiii@.hotmail.com> wrote in message >
> What happens if you just go to the URL?
> --
> John Saunders

errrr, it seems to work now. But I tell you it didn't before! ;)

Cheers
"Dave Smithz" <SPAM FREE WORLD> wrote in message
news:417fb0f2$1@.news1.homechoice.co.uk...
> "Scott Mitchell [MVP]" <mitchell@.4guysfromrolla.com> wrote in message
> news:h6Dfd.10379> Dave, in ASP.NET 1.x, there's not a real easy way to do
> this. There are
>> Master Pages - http://aspnet.4guysfromrolla.com/articles/040704-1.aspx -
>> but these have poor tool support in VS.NET 2002/2003.
> OK So not such a stupid question then. But now I probably have one. I've
> knocked together a basic ASP.net website to show someone. But I wnat to
> show
> them without having to run Visual Studio.net. Currently I press f5 to run
> the web application, but I want to be able to just go to a URL without
> having to run VS first.
> How do I do this?

What happens if you just go to the URL?
--
John Saunders

Newbie: how to handle large response.write blocks

Hi everyone -
Is there a way to abbreviate the aspx below? Specifically, is there a
way to eliminate the response.write syntax and escaped characters?
<%
if (MyObject.SomeBoolean)
{
Response.Write("<div class=\"myclass\">");
Response.Write("You may have won 1,000,000 dollars...");
Response.Write("lots of text...");
Response.Write("lots of text...");
Response.Write("</div>");
}
else
{
Response.Write("<div class=\"error\">");
Response.Write("You should buy more magazines...");
Response.Write("lots of text...");
Response.Write("lots of text...");
Response.Write("</div>");
}
%>
Thanks.
BrianIn C#, Not. If you want to have a literal quote in a string you have to plac
e
the \ escape before it.
Regarding not having to type Response.Write so much, try stuffing all your
strings into a StringBuilder instance. At the end, you can write one time:
Response.Write(myStringBuilder.ToString());
Peter
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com
"Brian F" wrote:

> Hi everyone -
> Is there a way to abbreviate the aspx below? Specifically, is there a
> way to eliminate the response.write syntax and escaped characters?
> <%
> if (MyObject.SomeBoolean)
> {
> Response.Write("<div class=\"myclass\">");
> Response.Write("You may have won 1,000,000 dollars...");
> Response.Write("lots of text...");
> Response.Write("lots of text...");
> Response.Write("</div>");
> }
> else
> {
> Response.Write("<div class=\"error\">");
> Response.Write("You should buy more magazines...");
> Response.Write("lots of text...");
> Response.Write("lots of text...");
> Response.Write("</div>");
> }
> %>
> Thanks.
> Brian
>

Newbie: how to handle large response.write blocks

Hi everyone -

Is there a way to abbreviate the aspx below? Specifically, is there a
way to eliminate the response.write syntax and escaped characters?

<%
if (MyObject.SomeBoolean)
{
Response.Write("<div class=\"myclass\">");
Response.Write("You may have won 1,000,000 dollars...");
Response.Write("lots of text...");
Response.Write("lots of text...");
Response.Write("</div>");
}
else
{
Response.Write("<div class=\"error\">");
Response.Write("You should buy more magazines...");
Response.Write("lots of text...");
Response.Write("lots of text...");
Response.Write("</div>");
}
%
Thanks.
BrianIn C#, Not. If you want to have a literal quote in a string you have to place
the \ escape before it.

Regarding not having to type Response.Write so much, try stuffing all your
strings into a StringBuilder instance. At the end, you can write one time:
Response.Write(myStringBuilder.ToString());
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com

"Brian F" wrote:

> Hi everyone -
> Is there a way to abbreviate the aspx below? Specifically, is there a
> way to eliminate the response.write syntax and escaped characters?
> <%
> if (MyObject.SomeBoolean)
> {
> Response.Write("<div class=\"myclass\">");
> Response.Write("You may have won 1,000,000 dollars...");
> Response.Write("lots of text...");
> Response.Write("lots of text...");
> Response.Write("</div>");
> }
> else
> {
> Response.Write("<div class=\"error\">");
> Response.Write("You should buy more magazines...");
> Response.Write("lots of text...");
> Response.Write("lots of text...");
> Response.Write("</div>");
> }
> %>
> Thanks.
> Brian
>

newbie: how to print stuff at the shell using C# while at programming in asp.net

Hi, I made myself a componment, so it can talk to the database.
I want to able to see the certain value within the code itself. And I'm unable to use asp:label control.
Is there's any way I can print stuff on the shell so I can keep track of where I'm at with my varable?
I tried Console.Write(temp); but it didn't seem to work :(
TIA
Use one of the System.Diagnostics.Debug.Writexxx() methods. These will appear in the Output Window in Visual Studio as you run the site under the debugger.
Alternatively, use the HttpContext.Current.Trace.Write() method, and this will put output into the ASP.NET Trace, which you can either see on the page or via the trace.axd handler.

Thank you very much DMW, System.Diagnostics.Debug.Writexxx() is useful

case close

Newbie: how to navigate from one to another asp in the project

Hallo everybody!
I have two asp-pages in my project.
There is a task on the first one, when the solution of the task ok, then
should the second page come. I made a menu for this. If the task solution
ok, then becomes the menu visible. Is it possible to activate automatically
the menu if the task solution ok? I mean, without the click on it? It it
possible to do all this simplier? I think somethink like this:

Protected Sub Button3_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button3.Click

If MySolution=true then

MySecondASPpage should be shown (what to entere here??)

end if

end sub

Thanks

BarbaraYou may want to use Response.Redirect("PageNameHere")

- V
Barbara Schmidt wrote:

Quote:

Originally Posted by

Hallo everybody!
I have two asp-pages in my project.
There is a task on the first one, when the solution of the task ok, then
should the second page come. I made a menu for this. If the task solution
ok, then becomes the menu visible. Is it possible to activate automatically
the menu if the task solution ok? I mean, without the click on it? It it
possible to do all this simplier? I think somethink like this:
>
Protected Sub Button3_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button3.Click
>
If MySolution=true then
>
MySecondASPpage should be shown (what to entere here??)
>
end if
>
end sub
>
>
>
Thanks
>
Barbara

Newbie: How to upload and save images using ASP.NET web forms (C#)

Hello -

I need to upload images in my web application using ASP.NET web forms
(written in C#). Since i have never done this before, i am unsure what is the
best method.

I assume there are two options:

1). Upload the images and save the files directory to the windows file
system. However, i assume this poses a security risk, as the file directory
will require write permissions.

2). Save the images (as objects?) in the SQL SERVER database.

Can anyone suggest the best way to do this? And, if possible, point me to
some sample code or artciles which explain how to do this.

Thanks!Charlie,

check out the following article:

http://www.codeproject.com/aspnet/fileupload.asp

I prefer to save files in the database but it depends on your needs.

If you need to save hundred thousands of files and decide that you want to
save them on your hard disk make sure to distribute them on different
directories. What you could do is that you assign a guid to each file and
create your directory structure accordingly.

Example:

You have five files with the following guids

0A59E8D6-0AE5-475B-8698-814C2C712029

F16CE1B1-56D0-42E6-9463-A58D553CC289

D90C27C7 -8BD9-4F47-8CFE-DE9D240AD136

370B6080-DF06-4DDE-BB5E-85264B8AE48B

861DC387-FDC7-4A4F-B0C3-9EA6734A562A

You could now create a directory like the following:

0A59E8D6\0AE5\475B\8698\814C2C712029

F16CE1B1\56D0\42E6\9463\A58D553CC289

D90C27C7 \8BD9\4F47\8CFE\DE9D240AD136

370B6080\DF06\4DDE\BB5E\85264B8AE48B

861DC387\FDC7\4A4F\B0C3\9EA6734A562A

HTHs

Daniel

"charliewest" <charliewest@.discussions.microsoft.com> schrieb im Newsbeitrag
news:E6DD7087-DC4F-4E78-9741-0EF7F76883B6@.microsoft.com...
> Hello -
> I need to upload images in my web application using ASP.NET web forms
> (written in C#). Since i have never done this before, i am unsure what is
> the
> best method.
> I assume there are two options:
> 1). Upload the images and save the files directory to the windows file
> system. However, i assume this poses a security risk, as the file
> directory
> will require write permissions.
> 2). Save the images (as objects?) in the SQL SERVER database.
> Can anyone suggest the best way to do this? And, if possible, point me to
> some sample code or artciles which explain how to do this.
> Thanks!