Reputation: 77
Basically I have a few asp.net objects. I get the ID of object 1 and assign it to a string. I then want to add a control to a placeholder than end in that ID. Not too sure how to go about doing this.
string id = Regex.Match(btnCreateHazard.ID, @"\d+$").Value;
phHazard(SOMEHOW GET THE ID HERE).Controls.Add(txtHazardDesc);
Thanks a lot.
Upvotes: 2
Views: 412
Reputation: 477
What i understood id you want to add a string to a control that u can do like this..
string id = Regex.Match(btnCreateHazard.ID, @"\d+$").Value;
placeholderId.Controls.Add(id);
OR
can refer below example. https://msdn.microsoft.com/en-us/library/kyt0fzt1.aspx
Upvotes: 1