Click here to Skip to main content
15,881,281 members

Comments by Ray Fischer (Top 5 by date)

Ray Fischer 4-Nov-19 10:57am View    
Okay, I found the source of the error and it was definitely going in the direction of ST0rmi's post (with a little help from Rick). I have a bunch of session variables which are constantly being regenned based on each of the individual (smaller) textboxes which in turn feed the larger fields to be parsed later on in the code. They were overwriting the field's contents within the statebag multiple times(!). Thus when I went to parse my string, it had reverted itself back to its old (prechanged) form. In terms of the TextBox not being found, this appeared to be a container problem. I was in fact recreating them with each postback and giving them the correct Name. But I was searching at page level and I needed to search at DataRow Level. There was also this very strange phenomenon of them not having the string I was looking for as an ID but rather as a UniqueID. I found some stuff online about this but can't really understand the difference.
Ray Fischer 16-Sep-19 8:31am View    
Thanks Richard, that did the trick. In some examples online which I saw about programmatically created controls, they had both the EventHandler and the Attribute creation listed as necessary for the created control object (?). Great support, man.
Ray Fischer 16-Sep-19 8:29am View    
Sorry F_ES, I did get it to fire after all. Right after I responded to your comment, I saw Richard's solution and it worked. I am running on now. Worked great. Thanks for the support and assistance.
Ray Fischer 16-Sep-19 7:30am View    
Hi F_ES,

Yes that was my understanding too. The problem is it is still not firing. The Event I am linking the EventHandler to is OnChange. I am not trying to fire it programmatically. It does detect that my text_box has been chagnged and performs a PostBack. But ist simply doesn't reach out to the EventHandler. ---Ray
Ray Fischer 13-Sep-19 10:10am View    
Hi F-ES,

Yes, I do have a section in the page load for that as well. But it doesn't get that far. As soon as I make a Change Event fire, it gives me the error. Here is my (else) for the !=IsPostback on Page_Load -
if (sessVars[i].Keyvis == true)
{
TextBox txtBxNm = new TextBox();
txtBxNm.Width = 48;
txtBxNm.ID = "txtBoxNomPt" + rw + cl;
txtBxNm.AutoPostBack = true;
txtBxNm.Attributes.Add("runat", "server");
txtBxNm.Attributes.Add("OnChange", "TextBox_TextChanged");
txtBxNm.TextChanged += new EventHandler(TextBox_TextChanged);
this.NomFlds.Rows[rw].Cells[cl].Controls.Add(txtBxNm);
if (sessVars[i].Value != "" && sessVars[i] != null)
{
txtBxNm.Text = sessVars[i].Value.ToString();
}

                    this.NomFlds.Rows[rw].Cells[cl + 1].Text = sessVars[i].PosDesc.ToString();
                }


So it is basically the same thing. NomFlds is simply a GridView which contains the text box controls.