Thursday, March 29, 2012
newbie: Help, I have problems with this!
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!
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?
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
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
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....
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>
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
>>
>
>