c# - Changing access modifier of CreateRow method of GridView -
is possible change access modifier in c# asp.net dll file.
for example, trying use createrow of gridview in c# asp.net , error
"system.web.ui.webcontrols.gridview.createrow(int, int, system.web.ui.webcontrols.datacontrolrowtype, system.web.ui.webcontrols.datacontrolrowstate) inaccessible due protection level"
i checked modifier , protected. when tried change, says readonly , cannot changed. possible?
update: trying dataset database , trying bind gridview. dataset might have upto 4 rows. if has rows less 4 remaining rows should shown empty in gridview. trying create 4 empty rows using createrow method , binding each row dataset. hope clear!
thank in advance!!
i'm not going anwer original question asked ("is possible change access modifier in c# asp.net dll file"), root of question (adding empty rows gridview).
i think better approach (rather trying call createrow on gridview) add empty rows dataset, , bind gridview. different based on specific data type storing data in, basic steps be:
- get data database
- use logic check how many rows there are
- if there less 4 items, add additionaly (empty) items / rows collection data stored step 1.
- set gridview.datasource data collection
- call gridview.databind();
to elaborate on step #3, this:
// dataset database dataset data = getmydatasomehow(); // create blank row object[] newrow = new object[3]; // "3" number of columns in table newrow[0] = ""; newrow[1] = ""; newrow[2] = ""; //add blank row data.tables["mytable"].beginloaddata(); data.tables["mytable"].loaddatarow(newrow, true); data.tables["mytable"].endloaddata();
Comments
Post a Comment