In some scenarios you may only want users of a particular role to delete records from the GridView. So you need a mechanism to disable/hide the delete link in the gridview based on roles. The code below will enable the delete link only for “Admin” roles and disable it for the rest.
Protected Sub gridView1_RowDataBound(ByVal sender As Object, ByVal e As system.Web.UI.WebControls.GridViewRowEventArgs) Handles Gridview1.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
If User.IsInRole("Admin") Then
Dim DeleteLink As LinkButton = CType(e.Row.FindControl("HyperLinkDelete"), LinkButton)
DeleteLink.Enabled = true
else
DeleteLink.Enabled = True
End If
End If
End Sub
August 25th, 2008 | Posted in Code snippets | 1 Comment
Most web hosts provide more mySQL databases than SQl Server 2005 database. To keep your hosting costs low , you might need to use MySQL in your projects.
To connect to MySQL database
First download the drivers here
Then copy MySql.Data .dll and MySql.Web.dll to your bin directory
The connection string is as follows
<add name="ASPNETDBConnectionString" connectionString = "Server=localhost;User ID=youruserID; Password=yourpassword; Database=databasename"
providerName="MySql.Data.MySqlClient" />
The MySQl Connector 5.2 has built in support for membership provider too. So from inside Visual Studio you can use the ASP.NET configuration to automatically generate the membership schema
August 25th, 2008 | Posted in Tutorials | No Comments
<%=ServerControlID.ClientID%>
Yes that’s all you need . For Example suppose you have a asp.net textbox server control whose ID is “Textbox1″ . In your javascript code to get the value of the control you will use something like this
var myValue= document.getElementById('<%=TextBox1.ClientID%>').value;
August 25th, 2008 | Posted in Code snippets | 2 Comments
I have been working ASP and ASP.NET since almost a decade back. Here I would just like to put down some stuff which I had difficulty finding the answers to. Hope it helps some guys looking for answers
August 25th, 2008 | Posted in Uncategorized | No Comments
I found a nice and simple control Artem Google Map control . Its free, very simple to use and instructions are clearly provided . Just download the control file and put it in your bin directory. Sign up for a new Google Map key and note down the key. Here is an example of using the control in your asp.net page
<artem:GoogleMap ID="GoogleMap1" runat="server" Width="500px" Height="400px" Key="your key here"
Latitude="26" Longitude="93.6" Zoom="5">
</artem:GoogleMap>
You can see a live demo here
August 25th, 2008 | Posted in Free ASP.NET controls, Uncategorized | 13 Comments
June 25th, 2008 | Posted in Uncategorized | No Comments
June 25th, 2008 | Posted in Uncategorized | No Comments
June 25th, 2008 | Posted in Uncategorized | No Comments
June 17th, 2008 | Posted in Uncategorized | No Comments
The world of web design and development language is dominated by two programming languages. Many web applications you see on the Web are based on either Microsoft’s ASP.NET or PHP. Before hiring a ASP Net developers or PHP programmer you need to first decide which option is best for your project and business. There are a number of things that you should consider and these are: the functions, the needs, and the main purpose of the web application. This article is written to provide you with what these two programming languages can and cannot do.
ASP.net is a proprietary programming language used to create dynamic web content. ASP allows using such databases as Access and SQL to create feature rich websites. By hiring a freelance web designer to do ASP.NET for you, you will benefit from dynamic content with standard Visual Basic and C# based applications and ActiveX Data.
One of many advantages of ASP.Net is that it allows monitoring and handling on-page events in a way that ensures full legitimacy of all user-entered information. Of course, there are other useful features like using web services conducted via proxy servers.
ASP.Net is developed by Microsoft and it’s been heavily marketed. You will find monthly updates provided by the official Microsoft support service, which make it more attractive to many ASP.Net developers and it’s an important factor for Web application development.
The second option is PHP. It’s an open source (freely available) programming language that developers can use to build feature rich dynamic websites. The term ‘open source’ means that there is no cost in licensing the language, and like thousands of open source software and scripts out there, it is available for anyone at no cost. You will find that more hosting servers support this language than ASP.NET because this reason. Just because it ‘s free doesn’t mean it’s limited, you will find many companies have used this language to build commercial scripts, so it is powerful language. The only thing that lacks behind is the support. So if you do have problems you are on your own to find the solutions. The PHP community is huge and you will find many sites are made for helping others to learn and discussion PHP.
Both languages are run on a server level which creates dynamic web content on the fly. They both are powerful enough to handle any tough applications and functions are roughly the same. So… whether you hire a ASP Net or PHP programmer, you will be fine, as long as you make sure they know the language inside out and can provide the level of support and service that you need.
March 15th, 2008 | Posted in General ASP.NET | No Comments