Tuesday, July 13, 2010

Passing parameter with the OnSuccess or OnComplete event in Ajax.BeginForm

passing a parameter with the OnSuccess event in a Ajax.ActionLink or Ajax.BeginForm is bit tricky...

< script type="text/javascript">
function ExeOnComplete(strParam1)
{
 alert('strParam1');
}
< /script>"


using (Ajax.BeginForm("Create", "Profile", new AjaxOptions { HttpMethod = "Post", OnComplete = "function(){ExeOnComplete('abc');}"}))
{
// your code here
}

Wednesday, July 7, 2010

Excellent FREE resource for learning Domain Driven Design

If you asked developers what books they should read, most would (or should) include Domain Driven Design by Eric Evans.

Why is it important?

The patterns and practices outlined in this book will help you develop more successful software solutions.

How?

Eric Evans shows how you can improve communication with your customer (by doing things like developing a ubiquitous language), implement agile practices and create maintainable solutions which follow good software development principles.

One of common criticisms of the book is that ‘it does go on a bit’.

The good news is that the folks over at InfoQ have come up with ‘Domain Driven Design Quickly’ which summarizes what Domain Driven Design is about.

The even better news is that it’s FREE if you register with InfoQ, which is no bad thing because it’s a fantastic resource with videos, presentations and some very good articles.

post ref : http://www.arrangeactassert.com/excellent-free-resource-for-learning-domain-driven-design/

Thursday, March 4, 2010

browser detection from Java script

/ Browser Detection Javascript
// copyright 1 February 2003, by Stephen Chapman, Felgall Pty Ltd

// You have permission to copy and use this javascript provided that
// the content of the script is not changed in any way.

function whichBrs() {
var agt=navigator.userAgent.toLowerCase();
if (agt.indexOf("opera") != -1) return 'Opera';
if (agt.indexOf("staroffice") != -1) return 'Star Office';
if (agt.indexOf("webtv") != -1) return 'WebTV';
if (agt.indexOf("beonex") != -1) return 'Beonex';
if (agt.indexOf("chimera") != -1) return 'Chimera';
if (agt.indexOf("netpositive") != -1) return 'NetPositive';
if (agt.indexOf("phoenix") != -1) return 'Phoenix';
if (agt.indexOf("firefox") != -1) return 'Firefox';
if (agt.indexOf("safari") != -1) return 'Safari';
if (agt.indexOf("skipstone") != -1) return 'SkipStone';
if (agt.indexOf("msie") != -1) return 'Internet Explorer';
if (agt.indexOf("netscape") != -1) return 'Netscape';
if (agt.indexOf("mozilla/5.0") != -1) return 'Mozilla';
if (agt.indexOf('\/') != -1) {
if (agt.substr(0,agt.indexOf('\/')) != 'mozilla') {
return navigator.userAgent.substr(0,agt.indexOf('\/'));}
else return 'Netscape';} else if (agt.indexOf(' ') != -1)
return navigator.userAgent.substr(0,agt.indexOf(' '));
else return navigator.userAgent;
}

Saturday, December 19, 2009

row count in UltraWebGrid from Java Script

protected void Page_Load(object sender, EventArgs e)
{

String Script = "javascript:function rowcount(gridname){var grid = igtbl_getGridById(gridname);var row =grid.Rows.length; if(row>0){var result =confirm('"+ GetGlobalResourceObject("Texts", "EmptyConfirmation") + "');return result;}else{return false;}}";
this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "InitVariable", Script, true);
uxEmptyTrash.Attributes.Add("onclick", "return rowcount('" + uxDocView.ClientID + "'+ '_uxBaseUltraWebGrid');");




}

Tuesday, September 15, 2009

LinkButton in Silverlight DataGrid

Here i will show how you can show linkButton in silverlight2 DataGrid:--

For my Project I needed to show a column as a link button. for implementing this i first tried using standard linkButton in DataTemplate:

XAML Markup:


<datatemplate key="BudgetTemplate">
<border borderthickness="5,0,0,0">
<hyperlinkbutton content="{Binding Budget}">
</hyperlinkbutton>
</border>
</DataTemplate>



then set the CelTemplate in DataGrid's Autogenaration Column event-
Code:
if(e.PropertyName == "Budget")
{
DataGridTemplateColumn budgetColumn = new DataGridTemplateColumn();
budgetColumn.Header = "Budget";
budgetColumn.CellTemplate = (DataTemplate)Resources["BudgetTemplate"];
e.Column = budgetColumn;
}

But after doing this it was not working properly. like when im going another page by clicking the hyperlinkButton then back agin this page the seleced row was hidden/blur for some reason. and there was no underline in the Hyperlinkbuttn when mouse hover.

the i tried in little different ways. i use a textblock instead of a linkbutton:


XMAL Markup:

<DataTemplate x:Key="BudgetTemplate">
<Border BorderThickness="1.5,0,0,0" BorderBrush="DarkGray">
<StackPanel Orientation="Vertical">
<TextBlock x:Name="budgetTextBlock" Foreground="#FF065091" Width="auto" MouseLeftButtonUp="budgetTextBlock_MouseLeftButtonUp" MouseEnter="budgetTextBlock_MouseEnter" MouseLeave="budgetTextBlock_MouseLeave"
Text="{Binding Budget}" Cursor="Hand"
Margin="2,0,5,0" TextAlignment="Right" HorizontalAlignment="Right"/>

</StackPanel>

</Border>
</DataTemplate>


And set the CelTemplate in the same ways. for showing the underline i use the mouse Enter and MouseLeave event:

private void budgetTextBlock_MouseEnter(object sender, MouseEventArgs e)
{
((TextBlock)sender).TextDecorations = TextDecorations.Underline;
((TextBlock)sender).FontWeight = FontWeights.SemiBold;
}


private void budgetTextBlock_MouseLeave(object sender, MouseEventArgs e)
{
((TextBlock)sender).TextDecorations = null;
((TextBlock)sender).FontWeight = FontWeights.Normal;
}


And it worked fine for me.

Monday, March 23, 2009

bubble sort in C#

int[] number = { 1, 6, 3, 9, 2, 8 };
int temp =0;

for (int i = number.Length ; i>=1; i--)
{
for (int j = 0; j < i-1; j++)
{
if (number[j]>number[j+1])
{
temp = number[j+1];
number[j + 1] = number[j];
number[j] = temp;

}
}
}

// Display the result in the messageBox
for (int i = 0; i < number.Length; i++)
{
MessageBox.Show(number[i].ToString());
}

Thursday, March 5, 2009

Useful website for Programming

Programing Related

http://www.geekpedia.com -- for sample project, article etc great place..
http://codebetter.com/ --for technology update
http://mootools.net/
http://jquery.com/ -- java script library
http://blogs.sun.com/greimer/resource/loop-test.html
http://www.ultrapico.com/Expresso. -- for regx in java script
http://famfamfam.com/lab/icons/silk/ --- for icon
http://www.webappers.com/
resources for web developers
http://blogs.hibernatingrhinos.com/nhibernate/Default.aspx // NHiberNateMapping
http://www.w3schools.com/
best resource for DOM and JS
http://www.forkcan.com/ //==========FOR Sharing code in social way...

//for c# custom date format
http://www.csharp-examples.net/string-format-datetime/

//for C# example code
http://www.csharp-examples.net/examples/

// conceptual website
http://www.dotnetperls.com/

//Interview question and answer:
http://johnmarsing.wordpress.com/2011/02/20/

//For JAVA
http://extreme-java.blogspot.com/2011/02/top-java-blogs.html

//For Business intelligence
http://biarchanddesignguide.codeplex.com/releases/view/6572



Humor
http://thedailywtf.com/ --====== (and what not to do while programming)
http://www.collegehumor.com/ == funny vedio,pic etc


http://blogs.msdn.com/tess/archive/2008/09/09/asp-net-memory-identifying-pages-with-high-viewstate.aspx
Good blog, and relevant page


http://www.oredev.org/toppmeny/video/november13/tessferrandezcommonproblemsinaspnet.4.3f1ff754117a0ed3480800015509.html

good screencast about live debugging, can be good to know when deploying big complex websites


http://weblogs.asp.net/bleroy/archive/2008/12/29/why-are-scripts-slow-to-load-in-firefox-when-using-visual-studio-s-built-in-development-web-server-a-k-a-cassini.aspx

http://silverlight.net/blogs/msnow/archive/2008/09.aspx?PageIndex=1
for learning silverlight

http://xoax.net/comp/cpp/console/Lesson4.php
for learning visual c++ .net

//for Project Estimation
http://realdn.planningpoker.com/games/41712



// for daily useful web reference
http://jasonhaley.com/blog/

Entertainment

http://www.musicovery.com/
//for listening music

//for lunch break
http://www.quakelive.com/

History:
// history of bangladesh libaration war
http://www.liberationwarbd.org/

Math
// http://www.khanacademy.org/

IT Management
http://itmanagersinbox.com

Others
//for printing any page
http://www.printfriendly.com/

// for becoming a good developer
http://vimeo.com/17151526



// for complete professional web layout
http://layout.jquery-dev.net/demos/container.html

5 Strategies for Getting More Work Done in Less Time

Summary.    You’ve got more to do than could possibly get done with your current work style. You’ve prioritized. You’ve planned. You’ve dele...