locked
Showing Data In GridView RRS feed

  • Question

  • User-646361536 posted

    Hi, In my web-application I have a gridView having 30 rows(I added them using dataTable), which is fixed and in The "serial no" column I have added data from 1 to 30. So, The gridView is also showing 30 rows. I made a buttonOnClick event to save the data in sql table. uptill it is working fine. But I want to show the data, saved by user, from sqlDB in the same gridview. Like if there is already 5 rows in DB-table it will be shown to the gridView's first 5 rows,and the remaining 25 rows will be blank.Can it is possible.Plz help!!!

    Wednesday, June 26, 2013 2:21 AM

Answers

  • User-85522823 posted

    Yes you can do it with the following ways : -

    1) You can set some flag which differentiate sql table with Datatable, check flag in rowdataboud event and show blank rows as per your flag.

    2) when you are saving rows in sql table, suppose you are saving only 5 then save other 25 rows as text "Blank" and then bind sql table with grid. It will show 5 records and remaining row it will show as "blank" 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, June 26, 2013 2:33 AM
  • User260886948 posted

    Hi,

    It will be easy to use flag. If flag=1 means this row will be blank, if the flag=0, then this row will show:

    select * from table where flag=1 //......blank row;

    select * from table where flag=0//......not blank row.

    Hope it can help you.

    Best Regards,
    Amy Peng 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, July 4, 2013 2:31 AM

All replies

  • User-85522823 posted

    Yes you can do it with the following ways : -

    1) You can set some flag which differentiate sql table with Datatable, check flag in rowdataboud event and show blank rows as per your flag.

    2) when you are saving rows in sql table, suppose you are saving only 5 then save other 25 rows as text "Blank" and then bind sql table with grid. It will show 5 records and remaining row it will show as "blank" 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, June 26, 2013 2:33 AM
  • User-646361536 posted

    Thanks smartymca, hope it will help me. Can you give me any link regurding to flag, as till now i have not used it.Thanx again!!

    Wednesday, June 26, 2013 2:41 AM
  • User260886948 posted

    Hi,

    It will be easy to use flag. If flag=1 means this row will be blank, if the flag=0, then this row will show:

    select * from table where flag=1 //......blank row;

    select * from table where flag=0//......not blank row.

    Hope it can help you.

    Best Regards,
    Amy Peng 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, July 4, 2013 2:31 AM