Now the problem was the required template was available under the custom template section ,so on page load first template section comes as default selected,so i have to select the appropriate template to check the available templates.
I tried to hide the template through object model ,but through object model I can remove the template permanently from the site,but here i have to hide the template.
So I tried this objective using javascript on the /_layouts/create.aspx page,which is not although not recommended to modify the OOB pages,To insert the javascript in to the page through HTTPmodule without touching the OOB page follow this post Link ,
but again challenge was this "Input Template Picker" control is a user control and on page loads it displays the template in the first tab only,so i checked the page view of the page and it contains only the value in the values in the first tab,
on clicking the next tab,control fires event through javascript and populates the control,so I was not able to capture the event.
Then while surfing I came across one blog which mentions about capturing the event when there is any change in page object,Bingo...now when i selects another tab , I was able to capture the event and write my logic to hide the template.
Here the javascript code contains an "onDocumentChange" DOM function which gets called when something changes on the page,Inside there is another delegate function which contains the logic is to get the collection of all the available option tag and then make the outerHTML value to empty.

Note: Here is another catch,first i tried to make the optionTag[i].Text to empty but what happened in the template selection panel,value disappeared but it still occupies the space and highlights on selection,so I make the outerHTML of the optionTag to empty.
So your job is done!!!
If you have any other method to do the same throug object model or through javascript then do reply
Enjoy!!!
Kindly can you help me doing the same in AddGallery.aspx (Sharepoint 2010 server silverlight enable site)? I am unable to hide one of the site template on this page.
ReplyDelete