Find ASP.Net Controls without using ClientID Tags in Javascript

Last Reply on Jun 08, 2012 02:03 AM By Mudassar

Posted on Jun 08, 2012 02:01 AM

Hi 

In my website i have some users these users have their own page that they can put their product on it.

their page name is Store.aspx 

and i have users table i want my users insert their keyword in DB  after that thier keyword fetch to meta tag i want all my users have differrent mete tag in their page how i can do it ?i try it with this code

 

this is my users table

Id

Name

Tell

Keyword1

Keyword2

Keyword3

 

 

 

 

 

 

 

 

 

 

 

 

string[] keywords = { "KeyWord_1", "KeyWord_2", "KeyWord_3" };

HtmlMeta htmlMeta;

foreach (string keyword in keywords)

{
       htmlMeta = new HtmlMeta();
       htmlMeta.HttpEquiv = "keywords";
       htmlMeta.Content = keyword;
       this.Page.Header.Controls.Add(htmlMeta);

}

 

but this error occur

The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).

 

 

is there any code in JQUERY that i do it?

 

thanks


Posted on Jun 08, 2012 02:03 AM

jQuery cannot populate meta tags. You need to remove <%%> tags and use jquery to find control as shown in the article

http://jqueryfaqs.com/Questions/How-to-find-asp.net-button-control-using-jQuery.aspx