Category Archives: Api

[RESOLVED] Default button

I have a form that contains a text box and 02 buttons. 1. Search, 2. Clear.

The user types some text in the text box and then click the search button to search for the phrase users has entered in the text box. I wanted to make the searh button default, So that the user after entring text simply press the enter button to search for the text, instead of explicitly clicking the search button.

Hi, you use:

Form.DefaultSubmitButton = "mySearchButton";


You can also use "defaultbutton" property of form tag in aspx page to make any Button in your aspx page as default Button.

try this

Form.DefaultButton ="btnSubmit"

Hope this code helps you

<asp:Panel runat="server" ID="SearchPanel" DefaultButton="btn_search">

             <asp:TextBox ID="tb_search" runat="server"  ToolTip="Enter your search criteria" />
             <asp:Button ID="btn_search" runat="server" Text="search" Font-Names="Arial" OnClick="btn_search_Click" />

             <asp:Button ID="btn_Clear" runat="server" />

Agree with Ramchandan.. You must use  Panel for achieve your functionality.

If you set Page's Default button property then for every unclicked thing it will fire DefaultButton Click which is wrong actually.

I wanted to make the searh button default, So that the user after entring text simply press the enter button to search for the text, instead of explicitly clicking the search button.

You can do that using Focus API. please check out below link Focus API section :

[RESOLVED] Anyone use BING API 2.0 for site search

I'm looking at options for creating a site search for my institution's website. The "regular" BING site search however leaves some things to be desired: we're a non-profit, so the ads won't fly with us. I also want the results to appear on one of our Web pages ("scraped"), not as the pop-up/out window, and certainly prefer to use our own site's styling.

So I'm looking at the BING API 2.0 instead and wondering if I'llbe able to use it as described. Has anyone else here used it like this? Any tips, recommendations or sample code for me? I'm thinking of using the XML data return option, as I already have a number of scripts in place scraping XML to our pages.

Any help would be greatly appreciated. Thanks!


Thanks for the link, Satish! Though I've already got that one tabbed in my browser.   :)

Was really curious though to see if anyone else here has actually used the API for search though...

I'm curious too. Has anyone tried using the API specifically for searching their own site? We've been using Google's site search for a while, but would really like to leverage the ability to use XML for the results without paying the hefty price tag that comes with site search.  

I'm using the Bing API with XML and it works beautifully. The only downside is that you have to wait for Bing to index new pages before they become available. 

Thanks for the reply. How long does it usually take them to re-index? Google site search seemingly catches new pages very quickly. How much volume do you get? 

Indexing was really slow when I first created my website. Now, my new pages are usually indexed within a day or two. You just have to make sure get some quality backlinks and regularly add new content. I get a lot more traffic from Bing than I thought I would, being that my website is mostly personal.

Is the only way to limit search results to your site by adding to the query? 

It's the only way I know. You can add it to the code behind on your server so the user doesn't have to see it in the URL though. 

Blank ASPX page OR Page not being rendered

I have an application that was built on IBS V1, its worked well over the years.  It was previously done with NotePad, I'm now using VS 2005.

The problem I'm experiencing is that some ASPX pages are being rendered as blank.  When I view sourcecode in Notepad, all the HTML is there, but nothing is displayed and there is nothing to select.  If this was happening to all pages, I could solve it. It appears to be totally random. I have two pages which are identical except for the parameters, one is displayed okay, the other is just blank.

 This is happening when I view in Localhost in IE (tried 6 & 7 same results).

 When I was first working in VS2005 when I switched to design mode it was also blank, but this seemed to correct itself. None of the pages that are NOT being displayed is giving any problem or reporting any error in VS2005 and the same with Web Developer 2008.


 I would sujest you check your stylesheet or styles on the page incase you have display: none; or anything else like that set, best way to test is remove all style sheet reference.

 Possibly even copy the html from source view then remove styles and css file reference and test again as this eliminates serverside code.

What happens when debugging in VS? same thing?



Its not style sheets,  as I said I have two pages which are identical apart from a parameter, one page works and the other doesn't.

 It has something to do with the Page Compiler.

 But if the page is showing source code then it should be displayed...

Could you show the offending page code to try and replicate?



The problem has been identified. Its Internet Explorer.  All other browsers display the page.  IE previously had displayed the page, no it displays blank (but does serve up the code) so its IE.

This has happened to a number of pages, and the pages worked up until something makes IE not render the page.

 IE was the last thing I suspected, I've spent over 70 hours on this problem.

I've done some more testing, and Firefox and Safari both work flawlessly with the pages, that IE draws blank.  Opera doesn't work either, but Opera doesn't render the menus either, which all other three browsers do.  Opera has worked fine on my DNN sites, but it hates this site which was built on IBS SDK ASP.NET Framework V1.1.

 I like both Firfox and Safari, but for the last 6 years we have been telling everyone that our site only supports IE. We are looking very foolish.

there is no doubt i can fix your issue if you give me some code....  Without code and without knowing exactly what you are dealing with we are all just tossing random guesses at what the heck might be going on.....  I was one of the rebels when it came to upgrading to VS2005, I was upgrading everything my company ever wrote to VS2005 when the first beta came out...  So let me tell you i have seen my share of issues with code that should have worked out of the box....  If you post some code or im me I'm sure we can fix ur issue i a lot less hours than u've already spent.....

Its not VS. This site was built using IBS SDK, which means it has full source code .aspx pages which are compiled as accessed. There are DLL Classes which handle data, they all work fine. They are linked via Framework V1.1 with the vbc compiler. And since the pages are rendered correctly in FireFox and Safari without ANY problems. It cannot be an Error.

You are right, there has to be something that is happening as I edit the pages but what, I'm only making changes to pages or controls. None of the Controls have been rendered blank. So it has to be something in the ASPX page that IE doesn't like.  Two of the pages which are giving me the same problem are totally different. Both worked until there was a change, the change has not caused any errors (I use VS 2005 as my editor, it has no problems on either of these pages. If I deliberetly create errors, it finds them. So the page gets compiled properly.  It has to be something in the way IIS serves up the page, that only IE doesn't like.

See IE Newsgroup for more info.  I tried loading the code from right click view source, AFTER I saved it to a file.  When I load the file into Firefox, it displays. When I load thge file into IE it displays nothing. So this is a PURE Internet Explorer issue.

The problem is the following;

 in the following;

    <title title="Edit Capital Income" />
    <link rel="stylesheet" href="../Portal.css" type="text/css" />

If I remove the following line, it all works.

    <title title="Edit Capital Income" />

 NOW the pages that work ALSO have the title, which was insisted by VS and IE did not object.



 Its more interesting as;

    <title title="Pupil Teacher Ratios - Primary"></title>

The above will work, but the following doesn't

 <title title="Edit Capital Income" />



 Wow that's an interesting one! I knew it wasn't serverside but i would never have removed the title!



The reason I started this thread was I couldn't find any other Posts on this problem.  I just tried again, no luck finding this Thread using Search.  I tried the exact search for "rendered as blank"  having copied it from my original post. It found two pages of Posts, but not this thread.

It was suggested in the IE newsgroup, that IE behaved properly (in that it had a problem with the way the tag was written, the person suggested that there is only one way to write a title trag and that is <title></title>.  If that is the case then VS-2005 needs to reflect this.  It appears a bit strange that VS and IE use a different set of rules to interpret HTML.

i had a similar issue, where the designer wasn't rendering the UI, although there was plenty of html etc. I removed the style tag in the <head> tag and voila, the UI shows up. 

I stumbled on this thread with the exact same problem with <TITLE/>. Appreciate finding this. FYI, I've found opening and closing an IFRAME in a single tag also causes major problems, iirc, elements open and closed with a single tag have also caused the web postback method to be "not found". As a rule, all elements I create an open tag and close tag for, even if empty.

[RESOLVED] embedded video player

 I am using visual basic web developer 2010 express.  I have downloaded aspnetflashvideo web control to my toolbox.  I then dragged it onto my web form and get the following 'Unrecognized tag prefix or device filter 'AspNetFlashVideo'.'  Is there something else I need to do when I added this control to my toolbox?



I then dragged it onto my web form and get the following 'Unrecognized tag prefix or device filter 'AspNetFlashVideo'


  Did you registered the Assemly ,  after the Page Directive..?

Suppose we are using MediaPlayerControl,

we register just like :

<%Register TagPrefix="cc1" Namespace="MediaPlayerControl" Assembly="Media_Player_Control" >

Check for the Namespace and Assembly and Register the tag prefix ,  if you have the sample source code,  check it out, you can find these codes in the top of the page..

Hope it helps you,

Mark as answer if it helped you...

Thanks & Regards,


The assembly was registered automatically when I dragged the control onto the form.  Here is the code :


  <%@ Register Assembly="ASPNetFlashVideo.NET3" Namespace="ASPNetFlashVideo" TagPrefix="ASPNetFlashVideo" %>


The target framework is .net framework 4.0 it that makes a difference.


I am not sure about the dll....but if you want to display videos on your can simply go for OBJECT Tag....

or else you can go for silverlight where videos can be played better....


Just a guess but I bet the assembly is not a .net 4 friendly assembly...


Try creating a .net 3.5 or even 2.0 application and drag it onto the page see if it works.

Check whether the assembly is friendly to the new 4.0 version....?

We have also searched this when we created the musical website as our project, but we used ASP.NET 3.5 framework...

We can't use OBJECT tag in an easy way, when playing videos.   Instead we can use MediaPlayerUserControl  for Playing videos as well as audios.

I am sure this will work because we have already used it...

  Check this link....

Thanks & Regards,


Thanks for your reply.  I think that I will try using silverlight mediaplayer.  The question I have is I am using camstudio to create a screen cast.  The file formats are api and swf type.  Will silverlight media player support these types of files or do I need to convert to wmv or is there another alternative?  Thanks for your help while I am trying to learn. 


It's very nice to see people learning.  I am also learning..

Check this site...  I think it will be useful for you...

Thanks & Regards,


[RESOLVED] Inject Javascript From CodeBehind


i am writing a web application in c#.I have defined some static javascript functions on a page.Those functions take as input some arguments that i want to pass from code behind.The problem is that i want to call these functions more than once, so i cannot define some variables and pass the parametres to the page.I want to inject the javascript that call the other javascript functions from code behind.Right now i am doing this using the RegisterStartupScript but this is not very convinient because i have to use escape characters etc.I have seen in some pages that javascript is writtenn on page using //<![CDATA[   JS code //]]> .Can someone help me inject code with this way?

Sorry for my English.

The CDATA solution wont help you in this scenario. This is for xhtml pages that want to be valid markup so you have to hide the javascript. Unfortunately the reason that you have to escape the javascript in the code behind is because you are putting it into a .net string.

You could use the @ modifier in some situations and it would reduce the amount of escaping you are doing:


One option is to put the javascript in an external file and use RegisterClientScriptInclude() to reference the external js file:

Put all of the static reusable code in there and then use the existing method of RegisterStartupScript simply to tie together your controls and the methods.