Question/Problem asp.net with C#

Discussion in '.NET' started by redking12, Jun 24, 2009.

  1. redking12

    redking12

    Joined:
    Jun 24, 2009
    Messages:
    2
    hey all, thank you for helping and sorry for my english.

    im building a website for a school project.
    i want to build a dynamic page which will show the users list.
    to do this page dynamic i am using Response.Write
    now, if i am writing in the response.write something like this
    Response.Write("<input type=text id=t name=t runat=server/>");
    i cant get the variable(of course i cant).
    how can i get it and the page will still stay dynamic.

    another thing:
    when i write some html in response.write (with name, just like the example above) in the Page_Load funciton, and trying to get the value of this input after postback it seems like it doesnt exist. i mean something like this
    if (IsPostBack)
    {
    string s=Request.Form["t"];
    }

    (after the post back i compared the string s to null and it was true)

    if the response.write is not in page_load i can get it's value.

    what i was trying to do is checkbox for each user - i succeed. but i couldnt get the value of the checkboxes(to delete the users that have been checked). i succeed to do that in <% %> in the design part of the page.

    third question:
    on the same page, i want to do the following thing:
    when the admin is double clicking on a userName(or something else) it will change to a textbox(currently its a text in a simple table - in <td>), then the admin write in the textbox another userName that does not exist(to change the current userName name) and then he enter the enter key. now the text that was in the cell will change into what the admin wrote. i succeed to do that with javascript, but my meaning is to change the username which is in the database- it means i dont have the access into the database from the javascript. the html i wrote in javascript is this one:

    Code:
    <form id="form1" runat="server">
        <script type="text/javascript" language=javascript>
        function C()
        {
            document.getElementById("t1").innerHTML="<input id=\"hte\" type=text size=7 maxlength=7/  onkeypress=\"{if (event.keyCode==13)Ggg()}\">";
            
        }
        function Ggg()
        {
            document.getElementById("t1").innerHTML=document.getElementById("hte").getAttribute("value");
        }
        
        </script>
        <div dir=rtl align=center>
        <table border=1>
        <tr>
        <td id=t1 ondblclick="C()">
        User Name
        </td>
        <td>
        Password
        </td>
        </tr>
        </table>
        </div>
        </form>
    
    so what i want to ask is if there's a function like "ondblclick" in C#

    thank you!

    by the way, i was trying to differentiate between two submit buttons after postback.
    I did the following as an example to my idea
    Code:
        <form id="form1" runat="server">
        <script type="text/javascript" language=javascript>
        function Sub1()
        {
            document.getElementById('h1').setAttribute("value","delete");
            
        }
        function Sub2()
        {
            document.getElementById('h1').setAttribute("value","change");
        }
        </script>
        <div align=center dir=rtl>
        <input type=hidden id=h1 name=h1 value="" />
        <input type=text id=t name=t size=10 />
        <input type=submit id=change name=change value=change onclick="Sub2()"/>
        <input type=text id=q name=q size=10 />
        <input type=submit id=delete name=delete value=delete onclick="Sub1()"/>
    <br />
            </div>
        </form>
    
    and then in the postback
    Code:
    if (IsPostBack)
             {
                 string h = Request.Form["h1"];
                 if (h == "delete")
                 {
    //what to do if we clicked the delete button
                  }
                 if (h == "change")
                 {
    //what to do if we clicked the change button
              }
    
    is it a good way to differentiate between them? (in the real code one submit button is dynamic - it can exist and it cannot exist in the page)
     
    Last edited: Jun 24, 2009
    redking12, Jun 24, 2009
    #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.
Similar Threads
  1. Ben
    Replies:
    3
    Views:
    1,191
  2. matt@mailinator.com
    Replies:
    6
    Views:
    760
    matt@mailinator.com
    Nov 15, 2005
  3. Bit Byte
    Replies:
    1
    Views:
    875
    Teemu Keiski
    Jan 28, 2007
  4. matt@mailinator.com

    ASP.NET 2: Membership/RoleMangement vs. ASP.NET 1.1.. question

    matt@mailinator.com, Nov 1, 2005, in forum: ASP .Net Security
    Replies:
    7
    Views:
    236
    matt@mailinator.com
    Nov 15, 2005
  5. Amelyan
    Replies:
    2
    Views:
    178
    Amelyan
    Apr 25, 2005
Loading...

Share This Page