Working with ajax tabContainer and ajax updatepanel.

by Administrator 5. January 2010 11:04

The ajax tabContainer and updatepanels can be a pain to work with in the VS designer.
After several hours found a solution to work with them and think it could be interresting to share it.

In our CMS there is several editpages with a lot of controls.
Some pages is hard to understand so I wanted to use the ajax tabContainer to structure the data.

When I did the setup of the page in the VS designer the problem started.

First the tabContainer did not render at all in the designer, or did render for some time and then stoped.
Most of the time the tabContainer shown the hated "Unknown server tag xxx" gray box.
Ofcourse all controls I put inside the TabPanels did not rendered.

To fix this problem I moved all my editcontrols out of the tabContainer.
Then I can work with them in the designer as usual.
I put PlaceHolder inside the tabContainer and use Server code to dynamicly move the editcontrols inside the correct TabPanels.

I works great as long as you don't try to move an ajax updatepanel...
Then this happends.
"Cannot unregister UpdatePanel with ID 'UpdatePanel1' since it was not registered with the ScriptManager"

Ops. I have one updatepanel inside one of the TabPanels so I need to fix this.
Now I started to feel a little frustrated.

I started to google and found out that the updatepanel have problem with dynamic pages.
It's when you move the updatepanel from one control to another control.
There is a blog about this problem here so I wont go into the details.

In the end it works as I wanted.
I can work in the VS designer with all controls and the updatepanel is working fine inside the tabContainer.

In the exampel code I have some tooltip javescript code and some other stuff that is not relevant for the problem.
What I want to show is the setup of the editpage.
I also want to show how I did it inside nested masterpages.

You can download the sample code here.
Hope you like it.

 

Tags:

Yahoo Site Explorer with uniqe domain in asp.net.

by Administrator 4. January 2010 22:15

Recently I found out about the Site Explorer from Yahoo.
It's great when working with SEO to see all in-links to a webbdomain.
It feels more responsive than Google webmaster and you can check all domains.

But, as always there are things to improve.
Searchengines like Goggle don't give higher ranking if you have many in-links from the same domain, so I wanted to filter the result based on domain.
Searchengines also don't like when we have many domains from the same IP, so I wanted to see the IP of the domains and see the number of domains from same IP.

I started to search the webb and found this page that has some similar .php code.

I also found that the yahoo Api was pretty easy to use, (if I compare to the Google Analytics Api).
Yahoo had some .net code ready for the request call and then I just needed to modify the querystring.

It's interresting that all docs is saying I need a Yahoo application ID. It's used to identify my application.
But when I tried the code It worked fine without the application ID.

One problem with the API is that we can only receive 100 Links back from one request.
The maximum number of links from on domain is 1000.
That means we need to loop the request up to 10 times to get all 1000 Links.
In the code I have a recursive function to fix that.

There is a limits from the API to 1000 links/domain and 5000 requests/day and ip.

Try it out here.
Download the sourcecode here.

Tags:

Vs2008 designer problem with nested masterpages.

by Administrator 2. January 2010 12:57

Yesterday I had this strange problem in Visualstudio 2008.
From one day to another the designer stopped rendering my controls in all my contentpages.
I have two nested masterpages and then contentpages.
The masterpages was working fine in vs designer, but the content was showing a blank page.

After several hour I found that a small update in the master page caused the problem.

I always use <div> insted of <asp:panel>. The problem was that I replaced a <div> with <asp:panel>. When I returned to use <div> everywhere in the masterpage, the vs designer suddenly started to render all contentpages again.
I have no idea why. I thougt <asp:panel> was the same as a <div> ?

Hope this can help someone with the same problem.

Tags:

Use Google Analytics as Visitor Counter in asp.net.

by Henrik 8. October 2009 16:37

The last six month I have spent my nights building a website for the local bandy team.
( If you don’t know anything about bandy you can take a look here.
http://en.wikipedia.org/wiki/Bandy )

They wanted a visitor counter on the site and I used some code I found on the web to quickly create one. It worked fine for some time, but the problem was that my counter did not show the same visitor number as the counter on Google Analytics.

Ok. Now the question was how to show the Google Analytics visitor number on the website.
I spent some time on the web for a quick solution but found none in asp.net.
But I found this site that had the base code for connecting to a Google Analytics account and getting results back as xml.
http://www.akamarketing.com/blog/103-introducing-google-analytics-api-with-aspnet-c.html


Now I had to solve two problems.
First was how the question was to be asked to get the correct answer.
I tried different combination from this page and checked the result as Xml.
http://code.google.com/apis/analytics/docs/gdata/gdataReferenceDimensionsMetrics.html

It took some time to get it right. 

The second problem was that I wanted a solution that I can use on several websites with different Google Analytics account.
I chose to authenticate with ClientLogin, witch means I log in with a normal Google account. The problem is that the bandy site is on a ftp where several people has access.

To make sure no one can get there dirty hands on my real admin Google Account, I created a new Google account on a different mail.

In Google Analytics I added the bandy Site to the new user so the new user can read but not edit.


Now I can use the new user account in my code to log in to Google Analytics and get results back.

Special thanks to Dave Callan for letting me use his code.

visitorCounter.zip (5.48 kb)

Tags:

My first tutorial on Code Project.

by Henrik 8. September 2009 16:30

As a developer I have spent several hours on the web reading programming articles and downloading code to see how things are done. To finally take the time and make one tutorial on my own is a god feeling.
This is the first article but there is more to come.

http://www.codeproject.com/KB/aspnet/Connect_Gridview.aspx

 

Tags:

Welcome

Pixcode is a software consulting company located in Trollhättan, Sweden.
We hope you enjoy our blog.

RecentComments

Comment RSS

Tag cloud