Saturday, December 18, 2010

JavaScript and SilverLight

I was trying out some SilverLight usig the project Template from VS Web developer and I wanted to to spawn a simple alert .
To register JavaScript from MailPage.xaml.cs, you need to HtmlPage.RegisterScriptableObject("Page", this);
and use the HtmlPage.Window.Invoke("<jsfunctionname>","<parameter>")

and from JavaScript in Silerlightap...aspx add a function with a simple alert mesaage, a parameter can be used as well
 in xaml:
<Grid x:Name="LayoutRoot" Background="White">
        <TextBlock x:Name="text">text</TextBlock>
  </Grid>
If you have a TextBlock in xaml then that textblock can be accessed from the cs and by using the attribute
[ScriptableMember]   you can write a function to modify some text value the cs, and since its ScriptableMember the value can be passes from JavaScript.

I think the syntax in JavaScriot would be something like
document.getElementById('silverlightControl'); //get the control having a textbox
page.<cs function>(some value);
and this would have the value in the silverlight control

I had read somewhere about this and I cannot find it now, I will do a test ASAP

Wednesday, December 15, 2010

Content Editor WebPart

Is there a way to show an Image on top of the MasterPage of SharePoint portal
I think using a content editor webpart, we can add a div tag with style of position:absolute
like <div style="position: absolute; left: 10px; top: 10px; height: 400px; width: 100px; "><img src=... /></div>

I will try this and update...

Saturday, December 4, 2010

js Calender

This one is probably the best I've seen and has some cool features like multiple date selection, but the best feature it says on the site, that I liked is that it does not depend on any 3rd party library, I haven't tested it but it good on the site
http://www.dynarch.com/projects/calendar/
I downloaded the source, that has a really cool demo,
got to their downloads page http://www.dynarch.com/projects/calendar/download/
much more stuff at  http://www.dynarch.com/

Wednesday, November 24, 2010

Extended GridView

I was trying to get a context menu for a GridView
 by displaying a div with a z-index on the grid wasn't very effective the I found this
http://aspalliance.com/946_Extended_GridView_Control.all
thanx Mr.Bilal Haidar

Sunday, November 21, 2010

ASP.NET MVC

Learning the ASP.NET MVC is quite something for those of us who have made Web Forms all the way, and it's the page controller type of design that is implemented by default in ASP.NET.
Visual Web Developer has the tamplate for MVC project and it automatically creates the Model View Controller Pattern with the folder structure. I think the URL routing to controller classes is a great feature.
To start off I did from http://weblogs.asp.net/scottgu/archive/2007/11/13/asp-net-mvc-framework-part-1.aspx
Its always good to see some code, and see http://www.mvcsharp.org/Getting_started_with_MVCSharp/Default.aspx there is this project on http://www.codeplex.com called Nerddinner its website http://www.nerddinner.com/ is a full fledged web app built on the MVC.

Thursday, November 18, 2010

FacebooK

The other day the question going around the office was 'What's the word starting with f and ending with k'
as I recall, In the forums of actionscripts.org one user had this as his signature and answered the question saying it was 'FiretrucK', this was obviously before FacebooK came about.
Well, the thing is I saw Social Network a while ago, and could'nt help noticing that he (Mark Zuckerberg) picks up user images from a host and creates the who's hot page in php. well I though that Idea would work where we had a folder dump in files and we had to display them like a picture album; Better yet we could have XML files in folders and a XSLT template, and we used the XML control to display the XML files using the template; Sounds easy , I guess...


Tuesday, November 16, 2010

Microsoft flash

      It was Macromedia then came Adobe and now it gonna be Microsoft, see this nytimes
 or so the rumors say -> cnet and zdnet
Its being speculated that Microsoft is buying Adobe, I think this would ease a few things and complicate a few things for the developers. We would have Blend come under flash (MS Expression Blend is the designer for SilverLight), complicated because, the flash guys (including me) wouldnt feel comfortable and the interface of Flash and PhotoShop would  look like blend??
Microsoft would love SilverLight to be the animation platform of the HTML5 browsers.
Even if Silverlight did get a push out of this, there would be loyal flash programmers. Just look at thefwa all the SOTDs (site of the day) are complete flash websites.

Friday, November 12, 2010

DataList example with embedded GridView

Hi
Designing a feature or a UI , sometimes, has customization involved to the extent that a developer used dynamic labels or literal controls to show data like the way it is needed. I one had this requirement to have tabular data preceded by a label.
just like this. I had used a dynamic literal control in a PlaceHolder and Adde a DataGrid Dynamically, then due to a performance hit I was forced to use a Repeater control.
here is am example that uses a DataList http://www.aspdotnetcodes.com/GridView_Inside_DataList.aspx
Thank you Asp.Net codes

Wednesday, October 13, 2010

Use many Ajax Panels and triggers on the same page

When you have to single page for a whole site or a main part of it then you have to use panels, making them visible or invisible.
Here is a very good article to start off understanding and working with Ajax panels and triggers
http://www.asp.net/ajax/tutorials/understanding-asp-net-ajax-updatepanel-triggers
When using two more update panels (and/or controls that are not in Panels) the trick is to use triggers to use the control id and the event method name
for a trigger
<asp:asyncpostbacktrigger controlid="Button1" eventname="Click">
You can see that example working here
The dopdownlist for the selection of color is outside any panel but has a trigger places for it in one of the panels and hence behaves like a part of the panel. This can be used when you have two (or more) panels (i.e like a set of controls) and you need some external check for controls in there.

Tuesday, October 5, 2010

SharePoint Site creation

It's really easy to create a website
First off log in as the admin
on the to top nav bar looks like

click sites , then create site and choose a blank site template (I usually do this because any custom web parts can be added later), the put in a name and description
and a URL name, its better to choose a small one (like total quality management would be TQM) . The new website will take in Default site permissions
finally click on create button to create the website
I work on SharePoint 2003, for SharePoint 2007/2010 look at this
how to create a site in ShaePoint

Sunday, October 3, 2010

Create uninstaller shotcut for installer in .NET

I had a small problem of creating an uninstaller, here's it is....

I recommend you go through this first : Setup and deployment in VS 2005

In you solution Add a new project
From project templates choose a windows project.



in program.cs of the new project add this code in main()


[STAThread]
static void Main()
{
    string[] arguments = Environment.GetCommandLineArgs();
    foreach(string argument in arguments)
    {
       string[] parameters = argument.Split('=');
       if (parameters[0].ToLower() == "/u")
       {
          string productCode = parameters[1];
          string path =  Environment.GetFolderPath(Environment.SpecialFolder.System);
         Process proc = new Process();
         proc.StartInfo.FileName = string.Concat(path,"\\msiexec.exe");
         proc.StartInfo.Arguments = string.Concat(" /i ", productCode);
         proc.Start();
       }
    }
}

In the setup and deployment project created for your project
(see this to help yourself create one: Setup and deployment)

Include uninstall program out put in your setup project
Add the uninstaller's output to the set up....



,

In "User's Program menu" create shortcut to Uninstaller project output (as shown in the images above and in properties of this shortcut in parameter 'arguments' insert value "/u=[ProductCode]".

Rebuild Solution.

Hope it helps ;)