I have a datagrid that loads on page_load.
In this instance I can't load the datagrid in page_init as the results of the datagrid are d开发者_C百科etermined by a checkbox and the checkbox would always be set to true during page_init thanks to the viewstate not being loaded.
I have an OnItemDataBound event on the datagrid that dynamically creates controls and later on I want to access the value of some of these controls (e.g. a text box)
Of course the problem is I can't access these controls values as they don't persist over a postback. Any idea how I can get round this problem?
You could put the code in Page_Init, and then check the value for the checkbox using the Request.Form collection to see if any change happened. That would be one way as in:
var value = Request.Form[this.chkCheck.UniqueID]; //may be ClientID
精彩评论