Client Side in Server side..Confused....

Discussion in 'ASP .Net' started by Erland, Sep 6, 2006.

  1. Erland

    Erland Guest

    Hello All,

    I am using AJAX library( AjaxEngine from
    http://www.mathertel.de/AJAXEngine/) and having problems and hope
    someone here can help me.
    I have some piece of javascript code that I intend to use in server
    side code.As I am using a javascript library so I have placed necessary
    javascript files in the project directory.
    I've placed a button on the webform and I would like to invoke
    following javascript code on every button click


    <div class="VEPart" id="me" style="LEFT: 220px; WIDTH: 180px; TOP:
    106px; HEIGHT: 90px">
    <div class="VEMover">: : : move me
    </div>
    I can be moved.
    </div>
    <script type="text/javascript">

    jcl.LoadBehaviour("me", MoverBehaviour);

    </script>


    My another concern is as I have to execute above javascript code on
    every click of the button I might have to figure out a way to generate
    random files of id of div, moreover, how would I access this id in
    server side code?

    At the bottom of this message, I have pasted the same program I was
    experimenting with. Being new to ASP.NET and especially Javascript
    world I have no idea what is required , though after relentless
    Googling I've been able to churn out the code attached at the bottom.
    Any help will highly be appreciated.

    Thanks,
    Erland





    ------------------------------------------------------------
    <%@ Page Language="C#" %>
    <script runat="server">

    private void page_load(object o,EventArgs e)
    {

    if (IsPostBack)

    this.Button1.Attributes.Add("onclick","javascript:create()");
    }

    </script>
    <html>
    <head runat="server">
    <title>Simple Mover Demo</title>
    <link href="mathertel.css" type="text/css" rel="stylesheet" />
    <script src="Mover.js" type="text/javascript"></script>
    <script src="jcl.js" type="text/javascript"></script>
    <script src="ajax.js" type="text/javascript"></script>
    <style>


    ..VEPart {
    border:1px solid gray;padding:2px;
    position:absolute;top:60px;left:80px;background-color:#FFFFAA}



    ..VEMover {
    position:relative; cursor:move;
    padding:0px 0px 2px 2px;background-color:#203050;color:white;}
    </style>
    </head>
    <body>
    <form runat="server">


    <asp:Button id="Button1" runat="server" Text="Button"></asp:Button>

    </form>

    <div class="VEPart" id="me" style="LEFT: 220px; WIDTH: 180px; TOP:
    106px; HEIGHT: 90px">
    <div class="VEMover">: : : move me
    </div>
    I can be moved.
    </div>
    <script type="text/javascript">



    jcl.LoadBehaviour("me", MoverBehaviour);


    </script>
    </body>
    </html>
    Erland, Sep 6, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page