Category Archives: Image

[RESOLVED] display the bitmap image


Dear all,

i had drawed a graph by clicking a analyze button, however when i click it, it will go to a new screen. below is my coding:

Response.ContentType = "image/gif"
 

        objBitmap.Save(Response.OutputStream, ImageFormat.Gif)




below is the condition i want, when i click the button Analyze, the image (graph) is showed under the button with the header and template:

 

my current condition is when i click the button analyze, it will totaly display the graph only without the header and template as print screen below:


 


how to change the coding to let the template and heaser showed together with the bar chart?


hope can get reply from any of you. i am using vb.net

thanks in advanced.

you can drow images in a separate page. and put one image control in your current page.

 when button click event you can change  imagecontrol image url to previously mentioned page.

button_click()
{
image1.imageurl="pageIsUsingToDisplayImage.aspx?imageId=someIdofimage";
}

if you want ot know more about handing image check this link

http://www.codeproject.com/Articles/126421/Image-Handling-In-ASP-NET.aspx

Selected Dynamic Menu item

I am trying to set the background color of a selected item in a dynamic dropdown menu.  I have a 10px horizontal padding on for the dropdown menu.  Some of the options in the menu are longer in word length.  I want to set the background color of a selected item across the entire width of the dropdown including the padding.  I have also tried setting padding in my css style sheet left and right but it doesn't give the desired effect because of the longer worded menu items.  At the moment I am only able to set the background color of the word itself in the dropdown menu.  On selected item the horizontal-padding goes back to 0 to incorporate the css padding.  I know this isn't the final solution but the issue still remains.  Any ideas?

Style sheet

.menubk TD /* Defines the entire menu background table */
{
  background-color:#2A2B64;
}
.menudynbkfor a /* Defines the top menu color and 'a' to override link default*/
{
  background-color:#2A2B64;
  color:#FFFFCC;
}
.menudynbk_select a /* Defines the dynamic selected item of menu color and 'a' to override link default*/
{
  background-color:#FFFFCC;
  color:#2A2B64;
  padding-left:10px;
  padding-right:10px;
}
.menudynbk TD /* Defines the dynamic dropdown menu color and 'TD' to override inherited table*/
{
  background-color:#2A2B64;
}


VB.Net Code

<asp:Menu ID="mnu" runat="server" CssClass="menudynbkfor"
                       DynamicEnableDefaultPopOutImage="False" DynamicHorizontalOffset="33" 
                        Orientation="Horizontal" StaticMenuItemStyle-HorizontalPadding="25" StaticEnableDefaultPopOutImage="False"
                        style="font-family: Arial, Helvetica, sans-serif">
                        <DynamicMenuItemStyle CssClass="menudynbkfor" HorizontalPadding="10px" ItemSpacing="5px" />
                        <DynamicMenuStyle CssClass="menudynbk" />
                        <DynamicSelectedStyle CssClass="menudynbk_select" HorizontalPadding="0px" />
                        <Items>
                            <asp:MenuItem Text="Publication" Value="Publication" Selectable="False">
                            <asp:MenuItem Text="Operational" Value="Operational"></asp:MenuItem>
                            <asp:MenuItem Text="System" Value="System"></asp:MenuItem>
                            <asp:MenuItem Text="Services" Value="Services"></asp:MenuItem>
                            </asp:MenuItem>
                            <asp:MenuItem Text="Rules" Value="Rules" Selectable="False">
                                <asp:MenuItem Text="Operational" Value="Operational" 
                                    ></asp:MenuItem>
                                <asp:MenuItem Text="Interface" Value="Interface"></asp:MenuItem>
                            </asp:MenuItem>
                            <asp:MenuItem Text="Interfaces" Value="Interfaces" Selectable="False">
                                <asp:MenuItem Text="System" Value="0"></asp:MenuItem>
                                <asp:MenuItem Text="System Pairs" Value="1"></asp:MenuItem>
                                <asp:MenuItem Text="Messages / Templates" Value="2">
                                </asp:MenuItem>
                                <asp:MenuItem Text="Elements" Value="3"></asp:MenuItem>
                            </asp:MenuItem>
                            <asp:MenuItem Text="Services" Value="Services" Selectable="False">
                            <asp:MenuItem Text="Providers" Value="Providers"></asp:MenuItem>
                            <asp:MenuItem Text="Services" Value="Services"></asp:MenuItem>
                            </asp:MenuItem>
                            <asp:MenuItem Text="Data Dictionary" Value="Data Dictionary"></asp:MenuItem>
                            <asp:MenuItem Text="Glossary" Value="Glossary" Selectable="False">
                                <asp:MenuItem Text="Acronyms" Value="Acronyms" ></asp:MenuItem>
                                <asp:MenuItem Text="Terminology" Value="Terminology"></asp:MenuItem>
                            </asp:MenuItem>
                        </Items>
                    </asp:Menu>


 

[RESOLVED] embedding image not displaying in emaill using vb.net

Hi

I am trying to display an embed an image within the body of an email. The is sent, however without the image.

Below is the code:

Dim mail As New MailMessage()


mail.[To].Add("siu07aj@reading.ac.uk")


mail.From = New MailAddress("atiqisthebest@hotmail.com")


mail.Subject = "Test Email"




Dim Body As String = "<b>Welcome to codedigest.com!!</b><br><BR>Online resource for .net articles.<BR><img alt="""" hspace=0 src=""cid:imageId"" align=baseline border=0 >"


Dim htmlView As AlternateView = AlternateView.CreateAlternateViewFromString(Body, Nothing, "text/html")


Dim imagelink As New LinkedResource(Server.MapPath(".") & "\uploads\CIMG1443.JPG", "image/jpg")


imagelink.ContentId = "imageId"


imagelink.TransferEncoding = System.Net.Mime.TransferEncoding.Base64


htmlView.LinkedResources.Add(imagelink)


mail.AlternateViews.Add(htmlView)


Dim smtp As New SmtpClient()


smtp.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis
smtp.Host = ConfigurationManager.AppSettings("SMTP")
smtp.Port = 587
'smtp.EnableSsl = True


smtp.Credentials = New System.Net.NetworkCredential(ConfigurationManager.AppSettings("FROMEMAIL"), ConfigurationManager.AppSettings("FROMPWD"))


smtp.Send(mail)

In the body of the email only the following is display:

Welcome to CodeDigest.Com!!

Any idea how I can get the CIMG1443.JPG displaying?

Thanks

Hi,

is  Image is there on The path Which Your Specifiying?

Dim imagelink As New LinkedResource(Server.MapPath(".") & "\uploads\CIMG1443.JPG")


imagelink.ContentId ="test"

OR

U send Html Image Tag then define image in that

Example :- --message--<img src="http://www.server.com/1.jpg"/>

OR

http://msdn.microsoft.com/en-us/vbasic/bb630227

above link may be good Resource for you.

[RESOLVED] Database value save

<div style="margin-top: 10.08pt; margin-bottom: 0pt; margin-left: 0.38in; text-indent: -0.38in; text-align: left; direction: ltr; unicode-bidi: embed; vertical-align: baseline;">enrolls (sid, coursecodesemester, year)</div><div style="margin-top: 10.08pt; margin-bottom: 0pt; margin-left: 0.38in; text-indent: -0.38in; text-align: left; direction: ltr; unicode-bidi: embed; vertical-align: baseline;">suppose Student enroll 5 or 6 courses(coursecode) of semester 1. how i can save in my table like this
</div>

sid

Course code

Semester

Year

b1

Csc100

1

2010

b1

Csc101

1

2010

b1

Csc102

1

2010

b1

Csc103

1

2010

b1

Csc104

1

2010

1)sid=sessionid

2)Dropdownlist select semester ==>> selected semester courses in a listbox

3)Year select


insert into enroll(sid,Semester,coursecode,year) values (@sid,@semester,@coursecode,@year) .

<div style="margin-top: 10.08pt; margin-bottom: 0pt; margin-left: 0.38in; text-indent: -0.38in; text-align: left; direction: ltr; unicode-bidi: embed; vertical-align: baseline;">
</div><div style="margin-top: 10.08pt; margin-bottom: 0pt; margin-left: 0.38in; text-indent: -0.38in; text-align: left; direction: ltr; unicode-bidi: embed; vertical-align: baseline;">
</div><div style="margin-top: 10.08pt; margin-bottom: 0pt; margin-left: 0.38in; text-indent: -0.38in; text-align: left; direction: ltr; unicode-bidi: embed; vertical-align: baseline;">
</div>

Hi,

This table is not enough.It is Bad Design.see how you will design tabes for it.

This gif is from 

Entity-Relationship (ER) Diagrams



Next You can Create View and Insert in that view otherwise you can use

Insert statement for Multiple tables.


Regards


I have to save Listbox  values in to my table (listbox multiply values i.e 6 vales)

listbox=coursecode


foreach (ListItem listitem in ListBox1.Items)

selected vales save table



Hi,

Ok if you don't bother about database design It is big prob from tomm.Anyways just see how you can write sql query to insert multiple records in table


Tutorial 3 - Adding Multiple Records to a Child Table Using Stored ...

[Solved] How to Insert multiple values from a listbox or ...

DotNet Asp: Inserting multiple values from a listbox into a ...


You can See this thread where someone has already resolved this issue

Insert Multiple Selected Items of a List box into table - ASP.NET ...

Regards

shabir

[RESOLVED] Populating a dynamically generated checklist control in code-behind not working

<div style="margin-top: 8px; margin-right: 8px; margin-bottom: 8px; margin-left: 8px; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(255, 255, 255); " mce_style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; margin-top: 8px; margin-right: 8px; margin-bottom: 8px; margin-left: 8px; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #ffffff; ">

(The following is a complete re-edit of the original post which was rambling, confusing etc...)

I have a form with a dynamically generated checklist:

<asp:CheckBoxList ID="cblGames" runat="server" DataSourceID="sqlGames" DataTextField="Game" DataValueField="Id" </asp:CheckBoxList>

 <asp:SqlDataSource ID="sqlGames" runat="server" ConnectionString="<%$ ConnectionStrings:Games %>" 

SelectCommand="SELECT [Id], [Game], [ShowWaitingList] FROM [Aanbod] WHERE ([ShowWaitingList] = @ShowWaitingList)">

 <SelectParameters><asp:Parameter DefaultValue="true" Name="ShowWaitingList" Type="Boolean" /></SelectParameters>

</asp:SqlDataSource>

The following code-behind is supposed to check those boxes that correspond to values stored in a database. It fails and I don't know why. Any ideas?

regards, Guy (p.s. [AanbodId] and [Id] are equivalent.)


if    (!Page.IsPostBack && Request.QueryString["id"] != null)
        {
               // Code that gets the data goes here. Removed for brevity's sake //
              ListItem currentCheckBox = cblGames.Items.FindByValue(reader["AanbodId"].ToString());
              if (currentCheckBox != null)
              {
                  currentCheckBox.Selected = true;
              }
             

            }
        }


</div>


First of all, here's a tip using the Insert Code tool:  Once you've inserted a code block, don't edit it.  That's probably how you ended up with all those spurious <SPAN> tags in your C#.  (No disrespect intended - just something I had to learn the hard way.)

Secondly, .aspx pages by default post back to themselves, so you shouln't need to redirect a page back to itself.  If you use Response.Redirect to do that, you'll loose all the information saved in viewstate, which may or may not explain why you're having this problem.

HI, (this post can be ignored, see re-edit above)


I tried to edit the code down because it's a little convoluted (I'm a newbie) and I hoped just presenting the key  would make it easier to understand the problem. I'm sure those span tags didn't show in the preview!


Anyway, the page only redirects after a new record is inserted. This insures that the user is presented with a blank form to enter the next record. I see the usefulness of viewstate for many tasks, but think it less than useful for database inserts which most of the time involve moving onto the next record. I considered resetting all entry fields to blanks in the code behind, but a redirect is simpler (if not  exactly elegant).

So I am still stuck with the original problem. Is it clear what I want to be done and what the problem is?

Both scenarios/solutions I've tried take place with viewstate (not that it is used). Neither give me the result I want.


regards, Guy

Are you running the above code in the CheckBoxList.DataBound handler or where?  (It won't work before that event.)

(And you're right about preview mode; it's useless.  You just have to learn the hard way, like all of us, that the code block starts and ends with the two blank lines above and below the code, and that once you click Insert, the only safe way to edit it is in HTML mode.  And even in HTML mode, you can't put HTML tags between the <PRE> and </PRE> tags.)