Click here to Skip to main content
15,889,651 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
this is the script for the may page

XML
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="test.aspx.vb" Inherits="test" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
    <script src="js/stuHover.js" type="text/javascript"></script>
    <link rel="stylesheet" type="text/css" href="../style-projects-jquery.css" />

    <!-- Arquivos utilizados pelo jQuery lightBox plugin -->
    <script type="text/javascript" src="js/jquery.js"></script>
    <script type="text/javascript" src="js/jquery.lightbox-0.5.js"></script>
    <link rel="stylesheet" type="text/css" href="css/jquery.lightbox-0.5.css" media="screen" />
    <!-- / fim dos arquivos utilizados pelo jQuery lightBox plugin -->

    <!-- Ativando o jQuery lightBox plugin -->
    <script type="text/javascript">
    $(function() {
        $('#gallery a').lightBox();
    });
    </script>
</head>
<body>
<!-- Here s as string variable  -->
<%  s%>
    <form id="form1" runat="server">
    <div>
    <div id="gallery">

        <asp:Button ID="Button1" runat="server" Text="Button" />
        <a href=>
        <asp:Image ID="Image1" runat="server"
            ImageUrl="~/gallery/Necklace/necklace13.jpg" />
            </a>
    </div>
    </div>
    <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True">
        <asp:ListItem>1</asp:ListItem>
        <asp:ListItem>2</asp:ListItem>
        <asp:ListItem>3</asp:ListItem>
    </asp:DropDownList>
    </form>
</body>
</html>



And this is the code where i have declare the variable

VB
Partial Class test
    Inherits System.Web.UI.Page
    Public s As String

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click

        Image1.ImageUrl = "gallery/Ring/ring5.jpg"
        MsgBox(s)
    End Sub

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        s = Image1.ImageUrl
    End Sub

    Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged
        If DropDownList1.SelectedValue = "1" Then
            Image1.ImageUrl = "gallery/Ring/ring5.jpg"

        ElseIf DropDownList1.SelectedValue = "2" Then
            Image1.ImageUrl = "gallery/Necklace/necklace2.jpg"

        ElseIf DropDownList1.SelectedValue = "3" Then
            Image1.ImageUrl = "gallery/bangal/bangal6.jpg"

        End If
    End Sub
End Class


Please help me

sir.....

Thanks ....
Posted
Updated 29-Jul-12 22:20pm
v2
Comments
Kenneth Haugland 30-Jul-12 4:22am    
Whats the error?
basurajkumbhar 30-Jul-12 4:26am    
Problem is i am not understand to how pass the string value of "s " to the to this link
Kenneth Haugland 30-Jul-12 4:31am    
You should, in this case, Bind the String and the Image1.ImageUrl togheter... That way you dont have to worry about updates in the Url...
basurajkumbhar 30-Jul-12 4:42am    
how can bind the image and string
when the dropdownlist value changed then
OriginalGriff 30-Jul-12 4:23am    
And your question is what?

1 solution

Here is one way to do it:

http://social.msdn.microsoft.com/Forums/en/wpf/thread/0b8877b6-095c-4d77-8bbe-536dfcf4c208[^]

Using binding requires a own string class, but once it set up, you dont need to think about how often it changes...

Otherwise you will have to hard code and set the string s each time it changes...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900