Question/Problem asp.net with C#

Joined
Jun 24, 2009
Messages
2
Reaction score
0
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:

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,040
Latest member
papereejit

Latest Threads

Top