GridView control won't display anything if no data from source.
Best practise: Create seprate add button to display a add panle to insert or Add
Alternative:
1. Using JavaScript to add blank row to GridView when click on Add button
<script type="text/javascript">
function AddNewRow() { var tblGv =document.getElementById('myTable'); var newRow =tblGv.insertRow(); //Adding three columns to the row var firstCell = newRow.insertCell(); var secondCell = newRow.insertCell(); firstCell.innerHTML = "<input type=textbox id='txtName1' >, <input type=textbox id='txtName2' >"; secondCell.innerHTML = "<input type=textbox name ='txtName' id='txtName' >";}
2. Add fake data in data source when click on Add button
3. Rrewrite GridView to display footer even no source data
No comments:
Post a Comment