Home > ASP Development > Making values of a column editable?

Making values of a column editable?



Helloo,



just wanted a definite solution on how to make the properties of a table editable, one specific column built in SQL, which in this case is integer values.



So far ive learnt that you would need to set a form Input element:

<input type="textbox" value="3" name="intSent1001">

for each row.



^ im not too sure on how to use this




Code:


<table cellspacing="2" cellpadding="2" border="0" class="BoxOutline">
<tr>
<td class="HeaderCell">LOCATION</td>
<td class="HeaderCell">COMPANY</td>
<td class="HeaderCell">CIRCUIT</td>
<td class="HeaderCell">TOWN</td>
<td class="HeaderCell">SENT</td>

</tr>
<%
dim ls_Class
ls_Class = "DetailsCell"
while not (lo_DataRst.BOF or lo_DataRst.EOF)
%>
<tr>
<td class="DetailsCell"><%= lo_DataRst("strLocation") %></td>
<td class="DetailsCell"><%= lo_DataRst("strCompany") %></td>
<td class="DetailsCell"><%= lo_DataRst("strCircuit") %></td>
<td class="DetailsCell"><%= lo_DataRst("strTown") %></td>
<td class="DetailsCell"><%= lo_DataRst("intSent") %></td>
</tr>






Help would be greatly appreciated, still learning asp



Thanks GA

    
Guest


I would do something like this...




Code:




<table cellspacing="2" cellpadding="2" border="0" class="BoxOutline">
<tr class="HeaderCell" >
<td >LOCATION</td>
<td >COMPANY</td>
<td >CIRCUIT</td>
<td >TOWN</td>
<td >SENT</td>

</tr>

<form method = "post" action="a_page_where_you_want_to_Update_data.asp"
>
<%
dim ls_Class
ls_Class = "DetailsCell"
i = 1
while not (lo_DataRst.BOF or lo_DataRst.EOF)
%>
<tr>
<td class="DetailsCell"><%= lo_DataRst("strLocation") %></td>
<td class="DetailsCell"><input type= "text" name ="give_a_name<%=i%>" value ="<%= lo_DataRst("strCompany") %>" /></td>
<td class="DetailsCell"><%= lo_DataRst("strCircuit") %></td>
<td class="DetailsCell"><%= lo_DataRst("strTown") %></td>
<td class="DetailsCell"><%= lo_DataRst("intSent") %></td>
</tr>
'dont forget to increment i value
i = i +1
pass in a hidden input value of i .

<input type = "hidden" name ="count" value = "<%=i%>"/>






Since you are going to have several columns to be updated on the next page.



retrieve the value by using.. hidden value of



for i = 1 to Request.Form("count")

updated_value = Request.form("give_a_name<%=i%>")

'do your update query to update that column

next

Was this answer helpful ? Yes No   
Guest


hello kansas,



many thanks for the reply, i will test this out tonite and bring back some feedback - THANKS!

Was this answer helpful ? Yes No   
Guest


hi kansas, just been testing this recently, this looks fine, just wanted to ask what the "count" does, is this a dummy name where the actual form name is meant to go, or is it the name for the variable to be updated? im getting an error at this point.



Thanks

Was this answer helpful ? Yes No   
Guest


Quote:
Originally Posted by kansasprogramme
I would do something like this...




Code:




<table cellspacing="2" cellpadding="2" border="0" class="BoxOutline">
<tr class="HeaderCell" >
<td >LOCATION</td>
<td >COMPANY</td>
<td >CIRCUIT</td>
<td >TOWN</td>
<td >SENT</td>

</tr>

<form method = "post" action="a_page_where_you_want_to_Update_data.asp"
>
<%
dim ls_Class
ls_Class = "DetailsCell"
i = 1
while not (lo_DataRst.BOF or lo_DataRst.EOF)
%>
<tr>
<td class="DetailsCell"><%= lo_DataRst("strLocation") %></td>
<td class="DetailsCell"><input type= "text" name ="give_a_name<%=i%>" value ="<%= lo_DataRst("strCompany") %>" /></td>
<td class="DetailsCell"><%= lo_DataRst("strCircuit") %></td>
<td class="DetailsCell"><%= lo_DataRst("strTown") %></td>
<td class="DetailsCell"><%= lo_DataRst("intSent") %></td>
</tr>
'dont forget to increment i value
i = i +1
pass in a hidden input value of i .

<input type = "hidden" name ="count" value = "<%=i%>"/>






Since you are going to have several columns to be updated on the next page.



retrieve the value by using.. hidden value of



for i = 1 to Request.Form("count")

updated_value = Request.form("give_a_name<%=i%>")

'do your update query to update that column

next






count is the total number of records you are trying to display on a page.hidden input variable with the value of i which gets incremented in the while loop..



on the next page retrieve count and make changes to the table. you can add a submit button after the hidden variable count.



if you run into problems paste your code and let's see how it goes from there

Was this answer helpful ? Yes No   
Guest
 
 
Home - About Infoqu - Contact - Privacy Statement - Link to Infoqu - Bookmark Infoqu

Copyright 2007-2008 by Infoqu. All rights reserved