I have a webform application in ASP .NET with C# and I want to fill a gridview from the webform.aspx.cs. Is there a way to fill "only" when entering the page, or should it be only with a click event. Could you tell me how to do it? Thank you very much for your help Regards
This is my Table or Grid in aspx (delete some columns because I use many and they are from my work...)
and to bind the data I do the following:
dtg_CutWeek IS THE NAME OF MY GRID IF YOU REALIZE IT IS THE ONE I USE TO MAKE REFERENCE IN THE BACKEND
In the webform.aspx you should have something like this, where dgvData is the identifier of your GridView.
In your codebehind webform.aspx.cs you should do something similar to this.
You can pass a Dataset from a DB, or directly a data collection as in this example.