+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11

Thread: edit with text box

  1. #1
    Barn Enthusiast guddu is on a distinguished road guddu's Avatar
    Join Date
    Jul 2008
    Location
    Oxford UK
    Posts
    390
    Rep Power
    3

    edit with text box

    hi
    i m displaying list of records with edit and delete button.code is here
    Code:
    If(Not rstSettings.EOF) then
    		   While Not rstSettings.EOF 		 		
    			lCounter = lCounter + 1
    			StrDisplay = StrDisplay & "<TR class=""Row" & lCounter Mod 2 & """>"					
    			StrDisplay = StrDisplay & "<TD align=""left"">"& rstSettings("ProtocolSettingNo")&"</TD>"
    			StrDisplay = StrDisplay & "<TD align=""left"">"& rstSettings("DocumentTypeNo")&"</TD>"
    			StrDisplay = StrDisplay & "<TD align=""left"">"& rstSettings("DocumentFormatNo")&"</TD>"
    			StrDisplay = StrDisplay & "<TD align=""left"">"& rstSettings("PartnerID")&"</TD>"
    			StrDisplay = StrDisplay & "<TD align=""left"">"& rstSettings("SettingValue")&"</TD>"
    			StrDisplay = StrDisplay & "<TD align=""right"" colspan=""2""><input type=""button"" name='btnEdit_"& vlMemberID &"' value=""Edit"" onClick=""fnNextPage('"& vlMemberID &"','"& Server.URLEncode(rstSettings("ProtocolSettingNo")) &"');"">"
    			StrDisplay = StrDisplay & "<input type=""button"" name='btnDelete_"& vlMemberID &"' value=""Delete"" onClick=""fnDelete('"& vlMemberID &"','"& rstSettings("ProtocolSettingNo") &"','"&rstSettings("DocumentTypeNo")&"','"&rstSettings("DocumentFormatNo")&"','"&rstSettings("PartnerID")&"','"&rstSettings("SettingValue")&"');""></TD>"
    			StrDisplay = StrDisplay & "</TR>"
    			rstSettings.MoveNext
    		  Wend 
    		Set objData = nothing
    		Set rstSettings = nothing
    	Else		
    		StrDisplay = StrDisplay & "<TR class=""Row1"" ><TD Colspan=7><font color=red><B>No Protocol Settings Found.<B></TD></TR>"
    	End If
    
    what i wanted to do is as user click on edit button then this coulmn "<TD align=""left"">"& rstSettings("SettingValue")&"</TD>" should display value in text box for edit purpose and edit button should display save button.as user click on save button then original column will display without text box and button will be edit button.

    how to do this?
    Love is physical attraction and mental destruction

  2. #2
    The Barnfather jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead's Avatar
    Join Date
    Mar 2008
    Location
    Washington, D.C.
    Posts
    2,347
    Blog Entries
    9
    Rep Power
    19

    Unless you want to have several requests to the server, your best bet would be to use JavaScript. If you want to use JavaScript, this thread can be moved to the appropriate forum.
    jmurrayhead
    If you agree, give me rep. If my post helped you, click "Thanks".
    If you like it here...throw us a few bones to help support us.


  3. #3
    Barn Enthusiast guddu is on a distinguished road guddu's Avatar
    Join Date
    Jul 2008
    Location
    Oxford UK
    Posts
    390
    Rep Power
    3

    i dont mind for javascript bcoz the solution is going to give by you guys only.

    cheers!!
    Love is physical attraction and mental destruction

  4. #4
    The Barnfather jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead's Avatar
    Join Date
    Mar 2008
    Location
    Washington, D.C.
    Posts
    2,347
    Blog Entries
    9
    Rep Power
    19

    First, have your ASP generate textboxes inside each cell and set their display property to none. The resulting markup should look something like this:

    Code:
    <tr>
        <td><span id="textcolumn1row1">Some text</span></td>
    </tr>
    
    When you click "Edit", it would look like this:

    Code:
    <tr>
        <td><span id="textboxcolum1row1"><input type="text" id="textbox1" /></td>
    </tr>
    
    To achieve this, you'll need to create a JavaScript function that accepts parameters to determine which row we're editing. When the "Edit" button is clicked, it will toggle the display property between inline and none (i.e. style="{display: none;}"). This, in turn will display your textboxes or text for that row.

    Keep in mind that each <span> must have a unique ID that you can use to pass to the function.
    jmurrayhead
    If you agree, give me rep. If my post helped you, click "Thanks".
    If you like it here...throw us a few bones to help support us.


  5. #5
    Barn Enthusiast guddu is on a distinguished road guddu's Avatar
    Join Date
    Jul 2008
    Location
    Oxford UK
    Posts
    390
    Rep Power
    3

    hi
    in this line i m getting javascript syntax error
    Code:
    StrDisplay = StrDisplay & "<TD align=""left""><span id='txtRow_"& lCounter &"'>"& rstSettings("SettingValue")&"</span><span style=""display:none"" id='txtBoxRow_"& lCounter &"'><input type=""text"" value="""& rstSettings("SettingValue") &""" name='txtBoxRow_"& lCounter &"' ></span></TD>"
    
    Love is physical attraction and mental destruction

  6. #6
    Barn Enthusiast guddu is on a distinguished road guddu's Avatar
    Join Date
    Jul 2008
    Location
    Oxford UK
    Posts
    390
    Rep Power
    3

    sorry not a error .JMH this is the what u said to do me?

    now next?
    Love is physical attraction and mental destruction

  7. #7
    Barn Enthusiast guddu is on a distinguished road guddu's Avatar
    Join Date
    Jul 2008
    Location
    Oxford UK
    Posts
    390
    Rep Power
    3

    hi
    now i javascript function i written this code
    Code:
    document.getElementById("txtRow_" + vlCounter ).style.display = "none";
    document.getElementById("txtBoxRow_" + vlCounter ).style.display = "";
    
    what next?
    Love is physical attraction and mental destruction

  8. #8
    The Barnfather jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead's Avatar
    Join Date
    Mar 2008
    Location
    Washington, D.C.
    Posts
    2,347
    Blog Entries
    9
    Rep Power
    19

    So you'll need something like this:

    Code:
    function makeVis(textSpanID,boxSpanID,action) {
        if action == "edit"
            {
                 document.getElementById(textSpanID).style.display = "none";
                 document.getElementById(boxSpanID).style.display = "inline";
            }
        else
            {
                 document.getElementById(textSpanID).style.display = "inline";
                 document.getElementById(boxSpanID).style.display = "none";
            }
     }
    
    Then set the onclick of your buttons to this function. I'm not strong with JavaScript, so there may need to be some corrections made.
    jmurrayhead
    If you agree, give me rep. If my post helped you, click "Thanks".
    If you like it here...throw us a few bones to help support us.


  9. #9
    Barn Enthusiast guddu is on a distinguished road guddu's Avatar
    Join Date
    Jul 2008
    Location
    Oxford UK
    Posts
    390
    Rep Power
    3

    that is already i have done.let me try whole stuff now.catch u later.

    Thanks a lot.
    Love is physical attraction and mental destruction

  10. #10
    Barn Enthusiast guddu is on a distinguished road guddu's Avatar
    Join Date
    Jul 2008
    Location
    Oxford UK
    Posts
    390
    Rep Power
    3

    forgot to ask u after submit how i will get value of
    name='txtBoxRow_"& lCounter &"'

    this text box
    Request.form("'txtBoxRow_")?
    Love is physical attraction and mental destruction

+ Reply to Thread
Page 1 of 2 1 2 LastLast

Similar Threads

  1. Field that is a link (rs) and/or text field question
    By Rebelle in forum ASP Development
    Replies: 14
    Last Post: August 12th, 2008, 08:43 AM
  2. Text or List option plus
    By Rebelle in forum JavaScript Programming
    Replies: 8
    Last Post: June 17th, 2008, 12:27 PM
  3. text display problem
    By todd2006 in forum HTML & CSS Help
    Replies: 10
    Last Post: May 7th, 2008, 08:14 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

SEO by vBSEO