I've been looking all over the web for a solution to this problem. I'm trying to find all the control IDs on a specific page from a different page when I pass the page's name. For example, I open Page1.aspx and I click on a button to get a list of control IDs on a second page Page2.aspx.
I found the following code on the Internet but I keep getting errors when I run it. I believe this code tries to open an instance of the page into memory, read the control IDs, and then close the page. However, I keep getting an error "Validation of viewState MAC failed".
Type type = BuildManager.GetCompiledType("~/Page2.aspx");
if (type != null)
Page myPage = (Page)Activator.CreateInstance(type);
I also have the following code for getting all the controls on a page from within the page (Page1.aspx). I need a similar code to get he controls on a different page.
privatevoid getControlList(System.web.UI.Control control, ArrayList resultCollection)
foreach (System.Web.UI.Control childControl in control.Controls)
System.Web.UI.WebControls.WebControl webControl = childControl as System.Web.UI.WebControls.WebControl;
if (webControl != null)
I have a form with auto postback set for custom validation on several text fields. It also has a list view of items which acts as a record selector to populate the text fields from a database when selected. The problem is that if I edit a text field and then click on the list view, the code behind for the text field runs and the listview returns to the previous selection which means the user has to click twice on the listview to select a new record. I'm sure there is a way to determine which option on the listview was clicked on and run the code behind for the listview after the code behind for the text box but I can't seem to find it. Doese anyone have any ideas or preferably a solution that they have implemented?
so on post back the focus issetto textbox1. i want to be on button1.
In my small company, we used a contract shop that setup an C#.net web form 2010 application. In the future, I will be supporting the website.
Thus I am wondering what are the categories I should check on to view the 'health' of a website. Also with these health checks, what would be recommendations on how to fix problems when they occur.
For example, I know this contract shop did not 'conserve' on viewstate and they used linq to sql instead of using the entity framework when setting up the website. Thus can you tell me if these and other categories are areas I should be checking on?
I have a gif image of the United States. Based on data in a database I would like to dynamically place points of some type on the gif. Then associate these points with a hotspot(imagemap control). Is this possible?
I have a controller that returns a FileContentResult that shows a pdf file in the browser. It works correctly in my local system but after I upload my site and try to reach that page I get "The resource cannot be found(HTTP 404)error".