Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / June 2007

Tip: Looking for answers? Try searching our database.

Whats wrong with this code"

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
active - 27 Jun 2007 02:37 GMT
<%@ Master Language="VB" CodeFile="Default.master.vb"
Inherits="Default_master" %>

<!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" xml:lang="en">

<head id="Head1" runat="server">

<title></title>

function resizeImg(o)

{

var p=o.parentElement;

if ((o.clientWidth/o.clientHeight)>(p.clientWidth/p.clientHeight))

{o.style.width='100%';o.style.height=''}

else

{o.style.width='';o.style.height='100%'}

}

--%>

</script>

</head>

<body style...

...

<asp:TableCell runat="server" ID="TableCellR4C1" Height="300"
BorderStyle="Groove">

<asp:Image ID="Image1" runat="server" AlternateText="Alternate Image"
ImageAlign="Middle"

ImageUrl="~/Images/mydefault.jpg" OnLoad="resizeImg(Image1)" Width="100%"

Height="100%" />

</asp:TableCell>

I get th error message:

'resizeImg' is not a member of 'ASP._default_master'
Masudur - 27 Jun 2007 06:35 GMT
> <%@ Master Language="VB" CodeFile="Default.master.vb"
> Inherits="Default_master" %>
[quoted text clipped - 50 lines]
>
> 'resizeImg' is not a member of 'ASP._default_master'

hi...

i dont see any start of script block.... just see a ending block "</
script>"
javascript function should be inside a script block

<script language="javascript" type="text/javascript">
function resizeImg(o)
{
}
</script>

what what is  " --%> " ???

Thanks
Masudur
http://munnacs.110mb.com
active - 27 Jun 2007 13:17 GMT
I deleted some comments when I posed this and must have deleted the line I
added below

Should I be using jscript or JavaScript

thanks

>> <%@ Master Language="VB" CodeFile="Default.master.vb"
>> Inherits="Default_master" %>
[quoted text clipped - 8 lines]
>>
>> <title></title>

<script type="text/JavaScript" language="JavaScript">

>> function resizeImg(o)
>>
[quoted text clipped - 55 lines]
> Masudur
> http://munnacs.110mb.com
Siva M - 27 Jun 2007 07:28 GMT
OnLoad represents a server-side function, not a client-side JS. So, make sure
you have defined the function in question in the code-behind of your page.

> <%@ Master Language="VB" CodeFile="Default.master.vb"
> Inherits="Default_master" %>
[quoted text clipped - 50 lines]
>
> 'resizeImg' is not a member of 'ASP._default_master'
active - 27 Jun 2007 13:14 GMT
Actually I need to know how to make it run client side

> OnLoad represents a server-side function, not a client-side JS. So, make
> sure
[quoted text clipped - 54 lines]
>>
>> 'resizeImg' is not a member of 'ASP._default_master'
Siva M - 27 Jun 2007 13:26 GMT
On the server side: Image1.Attributes.Add ("onclick", "resizeImg('" +
Image1.ClientID + "')");

Also, modify resizeImg() JS function to include the following as the first
line (before var p = o.parentElement):

var o = document.getElementById(o);

> Actually I need to know how to make it run client side
>
[quoted text clipped - 56 lines]
> >>
> >> 'resizeImg' is not a member of 'ASP._default_master'
active - 27 Jun 2007 14:09 GMT
> On the server side: Image1.Attributes.Add ("onclick", "resizeImg('" +
> Image1.ClientID + "')");

I don't know where to put the above.

Thanks for helping

> Also, modify resizeImg() JS function to include the following as the first
> line (before var p = o.parentElement):
[quoted text clipped - 64 lines]
>> >>
>> >> 'resizeImg' is not a member of 'ASP._default_master'
active - 27 Jun 2007 14:21 GMT
I did this and at least do not get any new errors - but I still get:
'resizeImg' is not a member of 'ASP._default_master'

thanks again

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load

Image1.Attributes.Add("onclick", "resizeImg('" + Image1.ClientID + "')")

End Sub

and

<script language="JavaScript" type="text/JavaScript">

function resizeImg(o) {

var o = document.getElementById(o);

var p=o.parentElement;

if ((o.clientWidth/o.clientHeight)>(p.clientWidth/p.clientHeight))

{o.style.width='100%';o.style.height=''}

else

{o.style.width='';o.style.height='100%'}

}

--%> </script>

and

<asp:TableCell runat="server" ID="TableCellR4C1" Height="300"
BorderStyle="Groove">

<asp:Image ID="Image1" runat="server" AlternateText="Alternate Image"
Height="100%"

ImageAlign="Middle" ImageUrl="~/Images/churchdefault.jpg" OnLoad="resizeImg"

Width="100%" />

</asp:TableCell>

>> On the server side: Image1.Attributes.Add ("onclick", "resizeImg('" +
>> Image1.ClientID + "')");
[quoted text clipped - 72 lines]
>>> >>
>>> >> 'resizeImg' is not a member of 'ASP._default_master'

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.