I encountered problem when modifying table in SQL Server 2008, Once the table is created open the table in SSMS by clicking on the table name and selecting “Design.” Try to include another column to the existing table and click on save (CTRL+S). It will prevent it from saving and will emit the following error in popup.
Saving Changes in not permitted. The changes you have made require the following tables to be dropped and re-created. You have either made changes to a table that can’t be re-created or enabled the option Prevent saving changes that require the table to be re-created
i searched the internet.. i got solution from pinal dave's blog
http://blog.sqlauthority.com/2009/05/18/sql-server-fix-management-studio-error-saving-changes-in-not-permitted-the-changes-you-have-made-require-the-following-tables-to-be-dropped-and-re-created-you-have-either-made-changes-to-a-tab/
Sunday, May 31, 2009
SQL SERVER – Fix : Management Studio Error : Saving Changes in not permitted. The changes you have made require the following tables to be dropped and
Labels: Sql Server
Download Cheatsheets - .Net, Sql Server, Php, Regular Expressions, CSS, Ajax,Javascript....
A cheat sheet or crib sheet is a concise set of notes used for quick reference.
You can download cheatsheets of various technologies like:
.Net
Actionscript
Ajax
Javascript
C#
HTML
Sql Server
CSS
JAVA
PHP
Regular Expressions
MySql
Asp/Vbscript
etc..
from
http://www.addedbytes.com/cheat-sheets/
http://www.cheat-sheets.org/
Labels: Ajax, Asp.net, Javascript, Sql Server
Download Ajax Loading Image
Since all the Ajax interactions happen behind the scenes asynchronously, the user doesn't understand what's going on: sometimes the user doesn't need to know what's going on (like when you are just reloading some data), but when he presses a button he needs to know that he did the right thing and that something is happening.
So we can show an "ajax loading image" when ajax process is going on..
You can generate these images from:
http://www.ajaxload.info/
You can also download from:
http://mentalized.net/activity-indicators/
Also you can search the google for ajax loading image and you will be able to see lots of images..
Labels: Ajax
Validating Extension(eg. (.aspx/.html/.jpeg....) in asp.net using Regular Expression
When you want to validate that the text entered must have particular extension that you have decided.
for example if you have a textbox to enter page name. You want the user to enter page name with ".aspx" extension. Then you have to use the following regular expression validator.
<asp:RegularExpressionValidator ErrorMessage=" Please Enter page name with .aspx extension"
ID="RegularExpressionValidator1" runat="server"
ValidationExpression="^.*\.(aspx)$" ControlToValidate="txturl" Display="Dynamic" ></asp:RegularExpressionValidator >
so now if the user enters "hello.abc" then validation will fire with message "Please enter page name with .aspx extension"
Thus with this ValidationExpression="^.*\.(aspx)$"
you can specify any extension like gif, jpeg or whatever you want..
^.*\.(exe|bat|etc)$
Labels: Asp.net
Set meta tag in asp.net programmaticaly for seo friendly websites
When you are developing SEO friendly websites, the first basic thing for seo is meta tags, as all search engines are looking for these meta tags while querying the database. Here we will allow the user to set the "keywords" and "description" (the two parts of meta tag)and then set the meta tag programmatically.
This is how meta tags are set dynamically:
HtmlMeta mKey = new HtmlMeta();Read More......
mKey.Name = "keywords";
mKey.Content = "home, blog";
this.Page.Header.Controls.Add(mKey);
HtmlMeta mdesc = new HtmlMeta();
mdesc.Name = "description";
mdesc.Content ="home page";
this.Page.Header.Controls.Add(mdesc);
after doing that you can view in the "View Source" of the page you have set meta tags under the head section.<meta name="keywords" content="home,blog" />
<meta name="description" content="home page" />
Labels: Asp.net
Read/Acess globalization section of system.web from web.config
To read web.config, and find any section there are number of solutions available, one such method to access globalization section which is under system.web of web.config is as follows:
In web.config i have
<globalization uiCulture="nl-NL" />
Now to read the uiculture in codebehind file in asp.net
string uicul = ((System.Web.Configuration.GlobalizationSection)(System.Configuration.ConfigurationSettings.GetConfig("system.web/globalization"))).UICulture;
Lets say for example i have to display date according to culture set in web.confg so:
public object GetDateCulture(object date)
{
string uicul = ((System.Web.Configuration.GlobalizationSection)(System.Configuration.ConfigurationSettings.GetConfig("system.web/globalization"))).UICulture;
System.IFormatProvider format = new System.Globalization.CultureInfo(uicul, true);
date = Convert.ToDateTime(date).ToString("dd MMM yyyy", format);
return date;
}
Ouput will be:
if culture is english : 22 May 2009
if culture is dutch : 22 Mai 2009
Read More......
Labels: Asp.net
Call a C# Method from aspx Page
Sometimes you need to call a method written in codebehind(.aspx.cs) from .aspx page.
Here is a simple example:
In your aspx page
<asp:Label ID="lbllable" runat="server" text='<%# GetCustomerID() %>' />
In your codebehind(.aspx.cs) page
- private string _CustomerID = "8888";
- protected void Page_Load(object sender, EventArgs e)
- {
- lbllable.DataBind();
- }
- public string GetCustomerID
- {
- get { return this._CustomerID; }
- }
When you are using in gridview or any other data bound control then
in your aspx page
<%# GetEmployee(Eval("EmpId"))%>
in your codebehind
public object GetEmployee(object EmpId)
{
EmpId = 1234;
return EmpId;
}
Labels: Asp.net
Friday, May 29, 2009
Validating Checkboxlist using CustomValidator
You might be knowing that required field validator doesn't works with required field validator... so to accomplish that purpose we can use custom validator to validate checkbox list.
<asp:CheckBoxList ID="chkModuleList"runat="server" >
</asp:CheckBoxList>
1) Using ClientValidationFunction
<asp:CustomValidator runat="server" ID="cvmodulelist" ClientValidationFunction="ValidateModuleList" ErrorMessage="Please Select Atleast one Module" ></asp:CustomValidator>
function ValidateModuleList(source, args)
{
var chkListModules= document.getElementById ('<%= chkModuleList.ClientID %>');
var chkListinputs = chkListModules.getElementsByTagName("input");
for(var i=0;i<chkListinputs .length;i++)
{
if(chkListinputs [i].checked)
{
args.IsValid = true;
return;
}
}
args.IsValid = false;
}
2) Using OnServerValidate
<asp:CustomValidator runat="server" ID="cvmodulelist" OnServerValidate="ValidateModuleList" ErrorMessage="Please Select Atleast one Module" ></asp:CustomValidator>
private void ValidateModuleList(object sender, ServerValidateEventArgs e)
{
int cnt= 0;
for(int i=0;i<chkModuleList.Items.Count;i++)
{
if(chkModuleList.Items[i].Selected)
{
cnt++;
}
e.IsValid = (cnt== 0) ? false : true;
}
}
Read More......
Labels: Asp.net
Thursday, May 28, 2009
Learning Sql Server Joins In Form of Venn Diagrams
Learn Basic Concepts of Sql joins like
Inner Join
Outer Join
Cross Join
Self Join
etc..
in the most simpler manner by pinal dave in the form of venn diagram.
He has explained sql joins with proper examples.. very good article for newbies on sql server
http://dotnetslackers.com/articles/sql/SQL-SERVER-JOINs.aspx
Labels: Sql Server
Wednesday, May 27, 2009
Reset/Clear all fields - Textbox/Dropdown/Radionbuttonlist/Listbox etc of a web form in Asp.net
In most of the case after inserting data into database or carrying out any other transactions. in which we have one form that contains bunch of textbox's, radiobuttonlist, checkboxlist, dropdownlist, checkbox, listbox etc or any other controls in asp.net .now after inserting data, on submit/save click we want to empty/reset/clear all controls in the web form, we actually do like this:
txtid.text ="";
ddid.SelectedIndex = -1;
and so on... and that for each textbox, dropdowns... etc it becomes very tedious and long.. so to make it short we should create a common function to reset all controls in web form...
Here is the ready made function :
Step 1:
///
/// Pankaj lalwani
/// Reset all textbox/radiobutton/dropdowns/listbox
///
///
public static void ClearFields(ControlCollection pageControls)
{
foreach (Control contl in pageControls)
{
string strCntName = (contl.GetType()).Name;
switch (strCntName)
{
case "TextBox":
TextBox tbSource = (TextBox)contl;
tbSource.Text = "";
break;
case "RadioButtonList":
RadioButtonList rblSource = (RadioButtonList)contl;
rblSource.SelectedIndex = -1;
break;
case "DropDownList":
DropDownList ddlSource = (DropDownList)contl;
ddlSource.SelectedIndex = -1;
break;
case "ListBox":
ListBox lbsource = (ListBox)contl;
lbsource.SelectedIndex = -1;
break;
}
ClearFields(contl.Controls);
}
}
Step 2:
Call this method on submit/save click after your code ends or sometimes when you provide clear/reset button to empty all fields
ClearFields(Form.Controls);
Labels: Asp.net
Data Navigation with the ListView & GridView, DataPager and SliderExtender Controls
Listview - Its a new control in asp.net 3.5, similar to gridview but much more capabilities than gridview..
Also Datapager - a new control in asp.net 3.5 used for data paging.
SliderExtender - a control of ajax toolkit
Combining all these three you can do wonders...
Below is an example of listview with datapager and slider extender
http://mattberseth.com/blog/2007/12/data_navigation_with_the_listv.html
Another example is of gridview with dataper and slider extender
http://www.dotnetcurry.com/ShowArticle.aspx?ID=219
The above links has source code to download, you can also view the live demo and play with the example..
Monday, May 25, 2009
Learn Sql Server 2008 New Features With Demos, Presentations
New to Sql Server 2008 - No need to worry, microsoft always is helpful in such cases.. Now you can learn new features of sql server 2008 interactively with fun, as it includes presentations, demos, hands on labs.. etc You can download the SQL Server 2008 Training Kit from the following link and follow the steps as given there.. also there are some basic system requirements need to be fulfilled while installing this toolkit.. all these are given below:
http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=e9c68e1b-1e0e-4299-b498-6ab3ca72a6d7
Labels: Sql Server
Saturday, May 23, 2009
Disable Copy/Paste in asp.net textbox
Sometimes you don't want to allow user to copy/paste or (Ctrl + C)/(Ctrl + V) in asp.net textbox.
You have to use onCopy="return false" onPaste="return false"
Here is an example of that:
<asp:TextBox ID="tb_Email" runat="server"
onCopy="return false" onPaste="return false" ></asp:TextBox>
This will restrict user from directly copy/paste into textbox, they have to type manually.
Labels: Asp.net
Set Language in Sql Server
When you are working with multi lingual web applications, you may need to retrieve data like month name, day name etc to be displayed in different languages. For example month "June" is in English, its dutch translation would be "Juni" .This is possible with "Set Language languagname" feature of sql server. where language name is the name of language you want to set.. you can complete list of languages that sql support using
"select * from sys.syslanguages"Read More......
Below is one example using set language, retrieving day and month name in different languages:
DECLARE @Today DATETIME
SET @Today = '6/22/2009'
SET LANGUAGE Deutsch
SELECT DATENAME(month, @Today) AS 'Month Name in Dutch'
SELECT DATENAME(dw, @Today) AS 'Day Name in Dutch'
SET LANGUAGE us_english
SELECT DATENAME(month, @Today) AS 'Month Name in English'
SELECT DATENAME(dw, @Today) AS 'Day Name in English'
Labels: Sql Server
Thursday, May 21, 2009
Integrating FCKeditor in Asp.net Websites
You might be using textarea, to input large text, but formatting is not possible with that, for that you needed WYSIWYG editor. There are plenty of rich text editors available in the market, but i would recommend you to use FCK Editor which is opensource freely available. I have to implement FCKEditor with my Asp.net Website, the following link explains in detail how to integrate with your asp.net websites.
Part I:
http://www.codedigest.com/Articles/ASPNET/208_Integrating_FCKeditor_in_ASPNet_Websites_%E2%80%93_Part_1.aspx
Part II:
http://www.codedigest.com/Articles/ASPNET/217_Integrating_FCKeditor_in_ASPNet_Websites_–_Part_2.aspx
Labels: Asp.net
Friday, May 15, 2009
FCK Editor With Custom Validation in Asp.net
I have to keep validation for fckeditor in my application, but then i came to know that Requiredfield Validator control of asp.net does not work with fckeditor. So I used CustomValidator control of asp.net and it worked perfectly.
You might be aware that customvalidator works in both ways. either clientsidevalidation function using javascript and servervalidate. Difference between them is servervalidate method takes server trip while in clientsidevalidation all validations fire at once without server trip.
I will be showing you both ways:
1) Using ClientValidationFunction
<script language="javascript" type="text/javascript">
function ValidateFCK(source, args) {
var fckBody = FCKeditorAPI.GetInstance('<%=FCKeditor1.ClientID %>');
args.IsValid = fckBody.GetXHTML(true) != "";
}
</script>
<FCKeditorV2:FCKeditor ID="FCKeditor1" BasePath="../fckeditor/" runat="server">
</FCKeditorV2:FCKeditor>
<asp:CustomValidator runat="server" ErrorMessage="Please Enter Description" ID="CustValDesc" ControlToValidate="FCKeditor1"
ClientValidationFunction="ValidateFCK" ValidateEmptyText="True"></asp:CustomValidator>
Note: Sometimes this method does not works with multiple browsers.
2) Using OnServerValidate
<FCKeditorV2:FCKeditor ID="FCKeditor1" BasePath="../fckeditor/" runat="server">
</FCKeditorV2:FCKeditor>
<asp:CustomValidator runat="server" ErrorMessage="Please Enter Description" ID="CustValDesc" ControlToValidate="FCKeditor1"
ValidateEmptyText="True" onservervalidate="CustValDesc_ServerValidate"></asp:CustomValidator>
protected void CustValDesc_ServerValidate(object source, ServerValidateEventArgs args)
{
if (FCKeditor1.Value == string.Empty )
{
args.IsValid = false;
}
else
{
args.IsValid = true;
}
}
Note:
Whenever you are submitting form and you have kept validations, always check whether the page is valid or not by:
if (Page.IsValid)Read More......
{
//your code
}
I also found some other method which works for Requiredfield validator with fckeditor isEnableClientScript="false" andInitialValue="<br/>"<asp:RequiredFieldValidator ID="req_Description" runat="server" ControlToValidate="FCKeditor1"
Display="Dynamic" InitialValue="<br/>" Text="Please Enter Description"
EnableClientScript="false"></asp:RequiredFieldValidator>
Labels: Asp.net
Sunday, May 10, 2009
Add Themes To Your Flex Application
Bored with your regular UI of your flex application, now make its look n feel better with ready themes.. there are number of themes available, just download them, add images, css, etc, to your flex application and here you go..your application is ready with beautiful themes.. you can also customize them according to your requirements..
http://www.scalenine.com/
Labels: Flex
Friday, May 8, 2009
Salesforce for Asp.net Developers
After learning some basics of salesforce, as discussed in previous post, if you want to integrate salesforce with asp.net, then you have to follow these steps as described in the below link.
http://wiki.developerforce.com/index.php/Force.com_for_ASP.NET_Developers
This article will show you how to create custom Force.com logic that you can call from within a Force.com application or from within a custom ASP.NET application hosted outside Salesforce.com with the help of webservice which interacts between force.com and asp.net..
Labels: Salesforce
Wednesday, May 6, 2009
Working with view states in flex
View state as name suggests while working in flex when you want to switch from one state to another state <mx:state> are used.
For example if you want to create login and register modules. so your first state is register and second state is login. so you can keep the register code in one state and set it as start state and keep the login code in another state. and after sucessful registration you want the login state to be enabled.. so you can achieve that using actionscript.. for all above you need to make use of <mx:state> below is the example i referred while accomplishing that...
http://blog.flexexamples.com/2007/10/05/creating-view-states-in-a-flex-application/
Labels: Flex
Monday, May 4, 2009
Getting Started With Salesforce
What is salesforce?
Salesforce.com is a vendor of Customer Relationship Management (CRM) solutions, which it delivers to businesses over the internet using the software as a service model.
There is no software needed for developement..everything is on internet
for more info on salesforce
http://en.wikipedia.org/wiki/Salesforce.com
Lets get started with developing applications with salesforce as a developer
1) Open the link in the browser
2) Register/Join Developer force by filling the registration form
3)You will receive your password in the registered email
4) open the link in the mail.. that will ask you for change password... change your password accordingly
5) you will be redirected to your developer force home page..
These were the steps i followed to get started with salesforce..
Now to create an application with salesforce, there are step by step flash tutorials, with screen shots and detailed explanation in the following link.
http://www.developerforce.com/flash_workbook/launch.html
The topics covered are :
- Creating an application with Force.com IDE
- Creating an application with Eclipse
- Using Formulas and Validation
- Using Workflows and Approvals
- Using Apex
- Adding Email Services
- Adding Test to your application
- Building User Interface with Visualforce
- Create a Web page using force.com sites
- Deploying an application
- Packaging & Distributing an application
Also the above tutorials are available in e-book format.it's called Force.com Developer Workbook.. you can download it from here..
http://developerforce.s3.amazonaws.com/books/Forcedotcom_workbookv2.pdf
and practice the tutorials at your lease..
Read More......Labels: Salesforce