
August 13th, 2007, 06:44 AM
|
|
Registered User
|
|
Join Date: Aug 2007
Posts: 1
Time spent in forums: 1 h 19 m 36 sec
Reputation Power: 0
|
|
|
Making div visible and applying styles
Hey everyone,
Having some issues with some Javascript code within ASP.Net and wondered if anyone could help.
I am having trouble applying styles to a <div> called 'updateDiv' within my code.
What i would like to do is make the div visible upon a asp event which i have done. However i would like my Javascript function 'makeVisible()' to detect the browser width so it is positioned in the middle of the screen.
However, none of the styles i have tried applying in this function are applied to the div when it gets set to visible by an ASP event.
Can someone point me in the right direction please?
Many thanks,
James
Code:
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="View4_Grid_View.ascx.cs" Inherits="JamesPlace_ASCX_View4_Grid_View" %>
<script type="text/javascript">
function makeVisible()
{
var up = document.getElementById('updateDiv');
up.style.width='100px';
//var w = screen.availWidth * 0.5;
//var h = screen.availHeight * 0.5;
//var l = screen.availWidth * 0.25;
//var t = screen.availHeigth * 0.25;
//up.style.width = w;
//up.style.left = l;
}
</script>
<body onload="makeVisible()">
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false"
OnSorting="GridView1_OnSorting" AllowSorting="true"
OnRowCommand="GridView1_RowCommand" onrowediting="GridView1_RowEditing"
>
</asp:GridView>
<asp:Panel ID="Panel1" runat="server">
</asp:Panel>
<div runat="server" style="visibility:hidden" id="updateDiv">
<table>
<tr>
<td>
<asp:Panel ID="PanelEdit" runat="server">
<asp:Button ID="ButtonSave" runat="server" Text="Save" onclick="ButtonSave_Click" />
<asp:Button ID="ButtonCancel" runat="server" Text="Cancel" onclick="ButtonCancel_Click" />
</asp:Panel>
</td>
</tr>
</table>
</div>
</body>
Last edited by colton22 : September 12th, 2007 at 12:24 PM.
Reason: Please Use [CODE] Tags...
|