Some day I will know everything. I hope that day never comes.
Anyone had luck with publishing the images using the Windows Live Writer using GeeksWithBlogs account?
SqlDataSource allows you to Select/Insert/Update/Delete the data from the database without even writing a single line of code. But sometimes you need to dynamically assign a parameter. First let's take a look at the simple update which does not dynamically assign the parameters. In the example below I am using a simple GridView control and updating the UserName, FirstName and LastName. The Bind("UserName") will get the username from the database and display it on the screen and it will also send ......
So, here is the story. I have a GridView which contains the ASP.NET CheckBox control. Each row also have the primary key of the database table. Now, I need to get the ID of the selected checkbox using JavaScript. I used a hidden field to store the ID of the row (The row is hidden and the user cannot see it on the display but you can see the value if you do the view source). Now, I like to access the hidden field of the selected row of the GridView. <asp:TemplateField> <ItemTemplate> <asp:CheckBox ......
Sometimes we need to open a small popup window and close the main (parent) window. Although you can achieve this by using a simple window.close(); or self.Close() method but when you try to close the parent window the security kicks in and asks that if you are sure that you want to close the parent window. You can however force the parent window to close without being asked. Here is the small code (originally written by JL): function OpenMainPage() { // open a new page window.open('Page2.htm','Pa... ......
If you have used SqlDataSource control with the GridView, FormView or the DetailsView and updating the data in the database using the UpdateCommand and UpdateParameters of the SqlDataSource control then you might be familiar with this error. The error "Could not find control 'xxx' in ControlParameter 'xxx'" is thrown when the ASP.NET is not able to find the requested control defined in the Update ControlParameters. Check out the code below which will throw the above exception: <asp:DetailsView ......
A new video has been published on how to use the Subsitution control in ASP.NET 2.0. You can view the video at the following url:
http://aspalliance.com/964_Video_Using_the_Substitution_Control_in_ASPNET_20
Sometimes in an application you need to unzip the folder and read the contents out of that folder. For unzipping purpose you can use the FREE SharpZipLib Library. Check out the code below which is used to unzip the zip folder and place the unzipped folder in the Files directory of the application. First, the Button_Upload is used to send the zip file to the Server's Folder. protected void Btn_Upload_Click(object sender, EventArgs e) { string folder = Server.MapPath("~/Files/"); string filePath = ......
I have just published a new article on GridViewGuy about Bread Crumbs in ASP.NET. You can read the article at the following link:
http://gridviewguy.com/ArticleDetails.aspx?articleID=198
Hope you like it!
I created a webpage which has few ATLAS controls and some of my custom code to display the Context Help. My Context Help appears as it should be but after it appears all the controls on the webpage dies. It means none of the controls responds to any events. The menu at the top which is a asp:Menu control stops working.
All I am doing is loading a static html page in the IFRAME when the mouse is placed on the link.
My page also inherits from a master page.
I know it is a beta version but anyways. I am not able to edit the post. Whenever I try to edit it throws the exception "Specific Cast is not valid".
You can easily populate a TreeView control by using a SiteMapDataSource control. This is extremely useful if you are using your TreeView control as a main navigation menu. All you need to do is to create a Web.sitemap file which will contain all the navigation of the website and use then use the SiteMapDataSource control to populate the TreeView control. Web.SiteMap: <?xml version="1.0" encoding="utf-8" ?> <siteMap xmlns="http://schemas.micro... > <siteMapNode ......
Context Menu's can be used to provide the help or displaying additional information to the user. You can easily create a simple context menu using JavaScript and plain old HTML. Check out the code: And here is the complete code: <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml... <html xmlns="http://www.w3.org/19... ......
There is a new AppendDataBoundItems property available in ASP.NET 2.0 framework which allows you to add items to the ListControls even if the ListControl is bound to the data source. In ASP.NET 1.X we used to add the default item in the collection which we were binding to the List but in ASP.NET 2.0 you can simply add the item in the DropDownList or any List control. <asp:DropDownList ID="ddlCategories" runat="server" AppendDataBoundItems="true"... <asp:ListItem Text="Select a category" /> ......
I have been trying to use the ATLAS ReOrderList with DataSet but it does not seems to work. I can see the bullet list but I am not able to see the item names in the ReOrderList. Is ReOrderList designed to work with DataSets?? Don't tell me NO!! <cc1:ReorderList CssClass="ReOrderControlStyle" OnItemReorder="ReOrderItemE... SortOrderField="Order" AllowReorder="true" DataKeyField="CategoryID" ItemInsertLocation="Beginning" DragHandleAlignment="left" ID="ReorderList1" runat="server"> <ItemTemplate> ......
ATLAS ReOrder List allows the user to well reorder the items in the list. Although it does provides the built in drag and drop functionality but lacks the sorting functionality and hence the developer has to implement it manually. I have demonstrated the examples of using the ATLAS ReOrderList control with the SqlDataSource and ObjectDataSource control. Database Table Schema: CREATE TABLE [dbo].[Categories] ( [CategoryID] [int] IDENTITY (1, 1) NOT NULL , [CategoryName] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS ......
I was reading the MSDN magazine when I came accross ELMAH in the ToolBox column by Scott Mitchell. ELMAH is developed by Atif Aziz and it consists of HttpModules and Handlers which are used to log errors of the web application. The errors are inserted into the database table which you can create with the script accompanied with the ELMAH application with complete source code. I am using it with one of my applications and it is working very nicely. With few settings in web.config you are good to go. ......
ASP.NET 2.0 provides a great feature of creating Bread Crumbs. Bread Crumbs appears as links or images and shows the user his current position in the website. This means if you are in horror books section under books so you can see a link something like: Home -> Books -> Horror Books Creating the Bread Crumbs is also very easy. All you need to do is to set up your Web.sitemap file correctly and use the SiteMapPath control to display the Bread Crumbs. It is wise to use the SiteMapPath control ......
If you have DropDownLists and LinkButtons inside the GridView control and you try to export the GridView to excel then the controls contained in the GridView are also exported to the excel spreadsheet. You can remove those controls and replace them with their selected value. Here is a small method called DisableControls that takes Control as parameter and replaces the DropDownLists and LinkButtons with Literal control. private void DisableControls(Control gv){LinkButton lb = new LinkButton();Literal ......
You can make use of the Wizard control template features to add a confirmation message when the "Cancel" button is clicked. Check out the following code: <asp:Wizard ID="MyWiz" runat="server"> <WizardSteps> <asp:WizardStep ID="WizardStep1" runat="server" StepType="Finish"> This is start </asp:WizardStep> </WizardSteps> <HeaderTemplate> This is the header template </HeaderTemplate> <FinishNavigationTemplat... <asp:Button ID="Btn_Finish" runat="server" ......
I have just written a new article "Extensive Study of the GridView Export to Excel" in which I talked about different ways that you can use to export the GridView to excel. You can check out the article at the following link. http://gridviewguy.com/Arti... powered by IMHO 1.3 ......
Those of you who have exported the GridView to Excel might have noticed that if you try to export a GridView with a column which displays number like 0034, 0012, 0045 etc. In other words the first digit is a '0' and the column is a varchar column then the exported excel file contains the data as 34, 12, 45. So, it removes all the zero's from the column data. You can easily keep the zero's by making small modification in the code. You can achieve this by adding style to the column. Check out the complete ......
The RSS Feeds for the GridViewGuy is now available. You
can use any RSS Reader control to display the feeds on your website.
powered by IMHO 1.3
ASP.NET provides the funtionality of securing many different files which include .aspx, .resources, .config etc. You can place the files inside a folder and make few adjustments in the web.config and that is it. Now, your files are secured for malacious users. Below is a small configuration that enables the protection on the files contained in the MySecureFolder. <location path="MySecureFolder"> <system.web> <authorization> <deny users="?"/> </authorization> </system.web> ......
I have just added a new videos section on GridViewGuy. Actually it is a new website www.videos.gridviewguy.com. Currently I have added few videos but I will be making additions every day. The website host couple of FREE Videos so check them out. Thanks and enjoy, powered by IMHO 1.3 ......
Dear friends,
I was involved in a small accident (I fell from somewhere). My right leg is a little sore. Anyway I will be back in couple of days.
Take care,
Azam