tags:

views:

189

answers:

2

The master page contains two pieces - .ascx control to hold meta information and this aspx page. The aspx page queries database (based on some URL parameter) and determines that the current database piece to display is x, and the display-name of x is y. ( All with the help of database).

Now, the meta tag should contain y as one of the keywords. I feel it would be too late if I set this up in the aspx page, because meta data is already generated by then.

What other options do I have? My meta control could query the database itself, but I would be querying database twice for the same information?

Please do not tell me how meta keywords are totally useless. That is not my part of the job. I am just told to integrate this thing in.

A: 

Can you create a public property on the meta control that holds a collection of keywords? You can add to that collection when you go off to get your data the first time, then have the meta control render any values that are present in the collection.

Chris Clark
A: 

The value of the meta tag in the .ascx control should only be output during the Render phase of the page lifecycle.

If you're using standard databinding controls the data binding is done in an earlier phase, so modifying the meta value at that point should be fine. If that's the case I'd recommend using the DataBound event of the data control to update the meta.

devstuff