3
Answers

Append records to a Gridview from a control

Chris Johnson

Chris Johnson

8y
286
1
Hello all.
I have a simple aspx page with a textbox which is the control, gridview and SQLDatasource which connects to a view on our SQL server. It succesfully finds a record when an ID is entered into the textbox.

Here is my problem. I do not wish to just show one record at a time. I wish to build the gridview from the records found, in other words appending records to the gridview.

Has anyone had experiance in this please?
Answers (3)
0
Laxmidhar Sahoo
NA 2.3k 1.4k 7y
<b> Report Date:&nbsp;&nbsp; 2016-11-21 &nbsp;&nbsp;Optometrist: &nbsp;&nbsp;start &nbsp;&nbsp;Time:&nbsp;&nbsp; Consultant: &nbsp;&nbsp;Dr.suresh</b>
0
Midhun T P
NA 19.7k 281.2k 7y
Hi,
 
Please try below query - 
  1. DECLARE @x XML = '<table WIDTH="100%" CELLPADDING="1" CELLSPACING="1">  
  2.    
  3. <tr style="COLOR: black; FONT-FAMILY: Arial; FONT-SIZE: 10pt;BACKGROUND-COLOR: #f2f2f2;">  
  4.    <td><b>Report Date : </b>2016-11-21 </td>  
  5.   <td><b>Optometrist : </b> </td>  
  6.   <td><b>Start Time : </b> </td>  
  7. </tr>  
  8.    
  9. <tr style="COLOR: black; FONT-FAMILY: Arial; FONT-SIZE: 10pt;BACKGROUND-COLOR: #f2f2f2;">  
  10.         <td><b>Consultant : </b>Dr.Suresh </td>  
  11. </tr>  
  12.    
  13. </table>'  
  14.   
  15. SELECT t.c.value('.''NVARCHAR(MAX)')  
  16. FROM @x.nodes('*') t(c)  
 
Reference :
https://stackoverflow.com/questions/38868364/sql-remove-all-html-tags-in-a-string