Sunday, March 11, 2012

How Can I change the properties of Ajax progress bar in code programatically!

Hi,

Thank you for your post.

It seems the "Top" and "Left" properties are custom properties of the UserControl.

So,

If you want change them at runtime at server side, do it like this:

PgbDataGrid.Top = "??"

PgbDataGrid.Left= "??"

If you want change them at javascript runtime at client side, it is up to what them mean to the client side, I give you a sample as follow:

Page.aspx:

<%@. Page Language="C#" %>

<%@. Register src="http://pics.10026.com/?src=TestUc3.ascx" tagname="TestUc3" tagprefix="uc1" %>

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

<script runat="server">

</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>

<uc1:TestUc3 ID="TestUc31" runat="server" Top="200" Left="300" />

</div>
</form>
</body>
</html>

TestUc3.ascx:

<%@. Control Language="C#" ClassName="TestUc3" %>

<script runat="server">
protected string top;
public string Top
{
get
{
return top;
}
set
{
top = value;
}
}
protected string left;
public string Left
{
get
{
return left;
}
set
{
left = value;
}
}
</script>
<style type="text/css">
.mystyle
{
top:<%=top%>px;
left:<%=left%>px;
position:absolute;
}
</style>

<div class="mystyle" id="testdiv">
Test...
</div>

In the above case, you can directly change the: document.getElementById("testdiv")style.pixelTop and document.getElementById("testdiv")style.pixelLeft

If you have further questions,let me know.

Best Regards,

No comments:

Post a Comment