How to get the index of the title on the page

How can I find and get the index of the control on the page, for instace I have MainBasePage.cs, which has the Load_page and is used by some main pages as the loading code, so for one of the main pages say mymaster.master , I need to find the head index and then add something after the header NOT in the header, but after <head></head> my literal here.

I would really appreciate any pointers. I tried doing Page.Master.Controls.IndexOf(Page.Header) but no luck

+4
source share
1 answer

I do not believe that html is permissible to put any tags between the head and body tags.

However, if you really want to do this for some reason, you can do this:

 <html> <head> </head> <%= StringToInsert %> <body> </body> </html> 

Then in the code behind, when the page loads, you can give it a value.

 public string StringToInsert; protected void Page_Load(object sender, EventArgs e) { StringToInsert = "<I'm almost certainly invalid HTML!>&nbsp;<I'm almost certainly invalid HTML!>"; } 
0
source

Source: https://habr.com/ru/post/1400289/


All Articles