From the category archives:

ASP.Net

Debug fails in Visual Studio 2005 with “Unable to attach. The binding handle is invalid.”

One fix is: turn on Terminal Services.

{ 0 comments }

ASP.Net TreeView

by Caroline Bogart on June 10, 2006

My first article on ASPfree.com

{ 0 comments }

Jesse Liberty Live

by Caroline Bogart on May 12, 2006

See best-selling .net author Jesse Liberty, free.

{ 0 comments }

V7N Tech Blog

by Caroline on May 10, 2006

Proud recipient of the first entry in V7n’s Web Development (Blogs about Web Development) Directory

{ 0 comments }

A master page must have a form tag with a runat=”server” attribute.

A PayPal donation button must be inside a form that posts to “https://www.paypal.com/cgi-bin/webscr”

You can’t put that as an action on the master page’s form tag because (a) it’s ignored, and (b) if it weren’t ignored you hardly want to state that all of your pages should be posted to paypal.com.

One solution is to post the master-page-derived form to a hidden page. The hidden page does not have a master page. It submits to PayPal.

Donation Page

Donation form

‹form action=”submit-paypal.aspx” method=”get”›
‹input type=”image”
src=”images/x-click-butcc-donate.gif” mce_src=”images/x-click-butcc-donate.gif”
style=”border:none” name=”submit”
alt=”Make your Thera-Puppy donation with PayPal - it’s fast, free and secure!”›

‹/form›

submit-paypal.aspx
The body tag loads the form. The user never sees this page. They are taken to form’s action location:
https://www.paypal.com/cgi-bin/webscr

‹%@ Page Language=”C#” AutoEventWireup=”true” CodeFile=”submit-paypal.aspx.cs” Inherits=”submit_paypal” %›

‹!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”›

‹html xmlns=”http://www.w3.org/1999/xhtml” ›
‹head runat=”server”›
‹title›Untitled Page‹/title›
‹/head›
‹body onLoad=”SubmitForm.submit()”›
‹form name=”SubmitForm” action=”https://www.paypal.com/cgi-bin/webscr” method=”post”›

‹input type=”hidden” name=”image_url”
value=”http://bogartcomputing.com/therapuppy/images/juggopop.jpg”›

‹input type=”hidden” name=”cmd” value=”_s-xclick”›

‹input type=”hidden” name=”encrypted”
value=”—–BEGIN PKCS7—– [a very long encrypted string from paypal here]==—–END PKCS7—–
“›
‹/form›

‹/body›
‹/html›

{ 0 comments }

Role-based file access and menu security

by Caroline Bogart on May 4, 2006

Show certain menu items and certain files to members of Administrators role. All else see basic site.

ASP.Net Web Site Administration Tool
Set one user to Administrators
Have another user that is in no role.

web.config, deny all but Administrators access to admin directory:

‹location path=”admin”›
‹system.web›
‹authorization›
‹allow roles=”Administrators” /›
‹deny users=”*”/›
‹/authorization›
‹/system.web›

‹/location›

web.config, system.web, roleManager enabled=”true”
web.config, membership, providers add defaultProvider:
‹siteMap defaultProvider=”AspNetXmlSiteMapProvider” enabled=”true”›
‹providers›
‹remove name=”AspNetXmlSiteMapProvider”/›
‹add name=”AspNetXmlSiteMapProvider” description=”SiteMap provider which reads in .sitemap XML files.” type=”System.Web.XmlSiteMapProvider” securityTrimmingEnabled=”true” siteMapFile=”Web.sitemap”/›
‹/providers›
‹/siteMap›

web.sitemap, add roles attribute to menu items to be masked:

‹siteMapNode url=”admin/admin.aspx” title=”Admin” Description=”Edit Functions” roles=”Administrators” ›
‹siteMapNode url=”admin/shelters_edit.aspx” title=”Shelters” description=”Edit Shelters/Rescues” roles=”Administrators” /›

{ 0 comments }

Which is more helpful:
1. “An error was encountered. Please return to the previous page and try again.”
2. A blank web page.
3. A DNS error while running on localhost

Scenario: setup “forgot password” smtp email for site being built on localhost but whose database is on remote server.

Web application
Click ASP.Net configuration icon
Configure SMTP Email Settings
Reply: DNS error, page cannot be found, or,a blank web page

troubleshooting
1: remove system.net and mailsettings from web.config
2. remove and replace remote database via aspnet_regsql

{ 0 comments }

The W3C CSS Validator doesn’t like the way ASP.Net 2.0 renders the asp:label control.

‹asp:Label ID=”lblSep” runat=”server” CssClass=”datalist” Height=”20px” /›

renders as:

‹span id=”ctl00_rightcontent1_DataList1_ctl01_lblSep” class=”datalist” style=”display:inline-block;height:20px;”›‹/span›

The problem is that display:inline-block is valid in CSS 3.0 but not CSS 2.0.

Note that the framework did not apply the CssClass datalist override:

display
{
display:inline;
display:block;
}

Answer? Let’s call it a workaround:
‹label style=”height:20px;”/›

{ 0 comments }

.net 2005 asp:login controls

by Caroline on April 25, 2006

ASP.Net 2005 provides a login control that creates a login form with a “remember me” cookie. The functionality to code ratio is huge:

ASP.Net asp login displayCreate two members (ctbogart, caroline) using the ASP.Net configuration icon on the top right of the solution explorer. Create two roles (Member, Admin). Assign ctbogart to the role Admin, caroline to the role Member.

Create two members (ctbogart, caroline) using the ASP.Net configuration icon on the top right of the solution explorer. Create two roles (Member, Admin). Assign ctbogart to the role Admin, caroline to the role Member.Create a web user control login.ascx. Add this tiny piece of code:
‹asp:login id=”login2″ runat=”server”›

Drag the control onto a web form. Run the project. Login. Wow.

Without a LoginView, the asp login control will display regardless of whether our user is logged in. It contains attributes to modify its appearance and abilities:
‹asp:Login ID=”login2″ runat=”server”
CreateUserText=”Create user”
CreateUserUrl=”create-new-user.aspx”
DisplayRememberMe=”true”
FailureAction=”RedirectToLoginPage”
FailureText=”Please try again”
InstructionText=”Enter your login and password”
LoginButtonText=”Click Here”
LoginButtonType=”link”
RememberMeSet=”true”
TextLayout=”textontop”
TitleText=”Hey You!”
UserName=”caroline”
UserNameRequiredErrorMessage=”Please enter your user name”
PasswordRequiredErrorMessage=”Please enter your password”
VisibleWhenLoggedIn=”false” /›

Conditional Login Display
A user can be anonymous or logged in. A logged in user can be in no role, one role, some roles or all roles. Our users are in the Member and Admin roles.

We can use the asp:Login code from above but I don’t yet know why there’s an align=right on the Click Here button link, so we’ll go back to the defaults.

The following code displays the login dialog when the user is logged off and a role-approriate message when the user is logged in:
‹asp:LoginView ID=”loginview2″ runat=”server”›
‹AnonymousTemplate›
‹asp:Login ID=”login3″ runat=”server”›‹/asp:Login›
‹/AnonymousTemplate›

‹LoggedInTemplate›
Hello, ‹asp:LoginName ID=”loginName1″ runat=”server”›‹/asp:LoginName›
‹/LoggedInTemplate›

‹RoleGroups›
‹asp:RoleGroup Roles=”Admin”›
‹ContentTemplate›
Hello, ‹asp:LoginName
ID=”loginName1″
runat=”server”›
‹/asp:LoginName›.‹br /›You are in role: Admin‹br /›
‹asp:LoginStatus ID=”LoginStatus1″ runat=”server”›‹/asp:LoginStatus›
‹/ContentTemplate›
‹/asp:RoleGroup›
‹asp:RoleGroup Roles=”Member”›
‹ContentTemplate›
Hello, ‹asp:LoginName
ID=”loginName1″
runat=”server”›
‹/asp:LoginName›. You are in role: Member‹br /›
‹asp:LoginStatus ID=”LoginStatus1″ runat=”server”›‹/asp:LoginStatus›
‹/ContentTemplate›
‹/asp:RoleGroup›
‹/RoleGroups›
‹/asp:LoginView›

{ 0 comments }

Showing input forms and thank you pages with multiview

by Caroline Bogart on April 15, 2006

The MultiView replaces showing and hiding div tags. Load the input form. When the user clicks submit (and the data is validated, not shown here), change the view to the confirmation pane.

‹asp:MultiView ID=”MultiView1″ runat=”server” ActiveViewIndex=”0″›
‹asp:View ID=”View1″ runat=”server” ›
‹table›
‹tr›‹td›Name‹/td›‹/tr›
‹tr›‹td›
‹asp:Button ID=”save” runat=”server” OnClick=”save_Click” /›
‹/td›‹/tr›
‹/table›
‹/asp:View›
‹asp:View ID=”View2″ runat=”server”›
‹table›
‹tr›‹td›received‹/td›‹/tr›
‹/table›

‹/asp:View›
‹/asp:MultiView›

{ 0 comments }

The ASP.Net community start kit for club websites uses a repeater for its main navigation bars. I couldn’t figure a way to use a repeater as a dropdown menu so I yanked it out and used a menu control.

The steps to replace the repeater with a menu control:

Create a user control controls/navbar.ascx as:
‹%@ Control Language=”C#” AutoEventWireup=”true” CodeFile=”navbar.ascx.cs” Inherits=”controls_navbar” %›
‹asp:sitemapdatasource id=”SiteMapDataSource1″ runat=”server” showstartingnode=”false”›
‹asp:Menu ID=”menu1″ runat=”server”
DataSourceID=”SiteMapDataSource1″
Orientation=”Horizontal”
DynamicEnableDefaultPopOutImage=”false”
StaticEnableDefaultPopOutImage=”false”

‹staticmenuitemstyle verticalpadding=”9″ size=”110%”›
‹staticitemtemplate›

‹asp:Label ID=”Label9″ runat=”server”
Text=’‹%# Eval( “Text” ) %›’›
‹/asp:Label›
‹/staticitemtemplate›
‹/asp:Menu›

Register the control in Default.master:
‹%@ Register Src=”controls/navbar.ascx” TagName=”navbar” TagPrefix=”uc1″ %›

Remove everything from between:
‹div id=”navtop”›‹/div›
and from between:
‹div id=”navbottom”›‹/div›

Replace with:
‹div id=”navtop”›‹uc1:navbar ID=”navbartop” runat=”server” /›‹/div›
and:
‹div id=”navbottom”›‹uc1:navbar ID=”bottomnav” runat=”server” /›‹/div›

{ 0 comments }

The ASP.Net 2.0 Community Starter Kits make the assumption that the host machine is running SQL Express.

This is because, I presume, they’re presented under the Visual Web Developer 2005 Express Edition site.

If you’re running Visual Studio.Net 2005 and Microsoft SQL Server 2005 the starter kits will not work out of the box.

You have to add an IIS application and convert the database to SQL 2005.

The Personal Web Site goes so far as to assume the aspnetdb.mdf file is already on your drive. To create an aspnetdb.mdf file you’d normally use the Visual Studio 2005 command prompt and run aspnet_regsql.exe. Or, you can get the kit I describe below and make the kluge fix as I did. aspnetdb.mdf will contain the user roles and memberships. You can avoid aspnetdb.mdf completely by changing the second web.config sql reference to be the same as the first, i.e., both ClubSiteDB and LocalSqlServer name the same initial catalog. Create xyz database (catalog), define your tables, keys, etc., then point both ClubSiteDB and LocalSqlServer to xyz.

Here is one way to solve the problem. The most elegant way would have been to run aspnet_regsql, but I wasn’t aware of that at the time I was writing this post.

Convert an mdf Express Personal Web Site kit to SQL Server 2005
Both the Personal Web Site and the PayPal-enabled eCommerce starter kits require aspnetdb.mdf. Since The PayPal kit has a copy, we’ll install that kit first.

These examples presume:
a physical web directory root of c:\aaweb
a SQL Server 2005 instance of 6510GZ\SQLSERVER2005
an ASPNET (aka 6510GZ\ASPNET) Windows account as the aspnet_wp account
Windows XP Pro

Commerce Start Kit (PayPal):
Download the PayPal Kit: The PayPal Kit link leads to a PayPal site link which leads to CommerceStarterKit.org. Register and download the kit.

Unzip the contents using “Use Folder Names” into your physical web directory area. I unloaded my zip to c:\aaweb\commerce. Open the IIS MMC, navigation to the c:\aaweb\commerce\website directory; get the properties for the Website folder and “Create” the Website application.

Note that the application runs from Website, not from the commerce directory above Website. When you open the web in Visual Studio 2005 you will open c:\aaweb\commerce\Website.

Open Sql Server Management Studio. My SQL 2005 instance is named 6510GZ\SQLSERVER2005. In Databases:
attach c:\aaweb\commerce\website\app_data\aspnetdb.mdf. Rename the result to ASPNET (it works, though I meant to rename it ASPNETDB).
attach c:\aaweb\commerce\website\app_data\commercedb.mdf. Rename the result to CommerceDB.

For both databases:
navigate to database security
add the 6510GZ\ASPNET system user
give the user aspnet_membership_fullaccess schema and aspnet_membership_fullaccess role membership.

In Visual Studio 2005 open the website c:\aaweb\commerce\website. Change the web.config configuration from Express to Server. Remove the commercedb.mdf and aspnetdb.mdf connection string elements and replace with Server connection strings:

New connection strings:
‹connectionstrings›
‹clear›

‹add name=”CommerceTemplate” connectionstring=”Data Source=6510GZ\SQLSERVER2005;Initial Catalog=CommerceDB;Integrated Security=True;”›

‹add name=”LocalSqlServer” connectionstring=”Data Source=6510GZ\SQLSERVER2005;Initial Catalog=ASPNET;Integrated Security=True;”›

Personal Web Site
The Personal Web Site download leads to this license agreement. Download the zip, unzip into c:\aaweb\personal, using folder names to maintain the zip directory structure.

The Personal.mdf database that comes with the personal starter kit is missing the personal.ldf log file. The mdf points to a non-existant ldf.

Open SQL Server Management studio. Create a new database named Personal. Make the owner 6501gz\ASPNET.

Start a new query. Open c:\aaweb\personal\app_data\personal-add.sql. Add the command:
use personal;
to the top of the script,
and execute the script.

Open Visual Studio 2005. Open the web site c:\aaweb\personal.

Change web.config connection strings as follows (remove the existing strings):
‹connectionstrings›
‹clear›

‹add name=”Personal” connectionstring=”Data Source=6510GZ\SQLSERVER2005;Initial Catalog=Personal;Integrated Security=True;”›

‹add name=”LocalSqlServer” connectionstring=”Data Source=6510GZ\SQLSERVER2005;Initial Catalog=ASPNET;Integrated Security=True;”›
‹/connectionstrings›

{ 3 comments }

‹%@ Page Language=”C#” MasterPageFile=”~/MasterAdmin.master” AutoEventWireup=”true” CodeFile=”admin2_testimonial.aspx.cs” Inherits=”admin2_testimonial” Title=”Untitled Page” %›
‹asp:Content ID=”Content1″ ContentPlaceHolderID=”leftcontent” Runat=”Server”›
‹asp:GridView ID=”gv” runat=”server” AutoGenerateColumns=”False” DataKeyNames=”idTestimonial” DataSourceID=”ds_view” OnSelectedIndexChanged=”gv_SelectedIndexChanged”›
‹Columns›
‹asp:CommandField ShowSelectButton=”True” /›
‹asp:HyperLinkField DataTextField=”idTestimonial” Text=”Select” /›
‹asp:BoundField DataField=”idTestimonial” HeaderText=”idTestimonial” InsertVisible=”False”
ReadOnly=”True” SortExpression=”idTestimonial” /›
‹asp:BoundField DataField=”company” HeaderText=”company” SortExpression=”company” /›
‹/Columns›
‹/asp:GridView›

‹asp:DetailsView ID=”dv” runat=”server” AutoGenerateRows=”False” DataKeyNames=”idTestimonial” DataSourceID=”ds_edit”›
‹Fields›
‹asp:TemplateField HeaderText=”idTestimonial” InsertVisible=”False” SortExpression=”idTestimonial“›
‹EditItemTemplate›
‹asp:Label ID=”Label1″ runat=”server” Text=’‹%# Eval(”idTestimonial“) %›’›‹/asp:Label›
‹/EditItemTemplate›
‹ItemTemplate›
‹asp:Label ID=”Label1″ runat=”server” Text=’‹%# Bind(”idTestimonial“) %›’›‹/asp:Label›
‹/ItemTemplate›
‹/asp:TemplateField›
‹asp:BoundField DataField=”firstName” HeaderText=”firstName” SortExpression=”firstName” /›
‹asp:BoundField DataField=”lastName” HeaderText=”lastName” SortExpression=”lastName” /›
‹asp:BoundField DataField=”email” HeaderText=”email” SortExpression=”email” /›
‹asp:BoundField DataField=”phone” HeaderText=”phone” SortExpression=”phone” /›
‹asp:BoundField DataField=”company” HeaderText=”company” SortExpression=”company” /›
‹asp:BoundField DataField=”website” HeaderText=”website” SortExpression=”website” /›
‹asp:BoundField DataField=”street” HeaderText=”street” SortExpression=”street” /›
‹asp:BoundField DataField=”city” HeaderText=”city” SortExpression=”city” /›
‹asp:BoundField DataField=”state” HeaderText=”state” SortExpression=”state” /›
‹asp:BoundField DataField=”zip” HeaderText=”zip” SortExpression=”zip” /›
‹asp:BoundField DataField=”testimonial” HeaderText=”testimonial” SortExpression=”testimonial” /›
‹asp:CheckBoxField DataField=”phoneReference” HeaderText=”phoneReference” SortExpression=”phoneReference” /›
‹asp:CheckBoxField DataField=”emailReference” HeaderText=”emailReference” SortExpression=”emailReference” /›
‹asp:CheckBoxField DataField=”approved” HeaderText=”approved” SortExpression=”approved” /›
‹asp:CommandField ShowEditButton=”True” /›
‹/Fields›
‹/asp:DetailsView›
‹asp:SqlDataSource ID=”ds_view” runat=”server” ConnectionString=”‹%$ ConnectionStrings:ryason %›”
SelectCommand=”SELECT [idTestimonial], [company] FROM [testimonial]“›‹/asp:SqlDataSource›
‹asp:SqlDataSource ID=”ds_edit” runat=”server” ConnectionString=”‹%$ ConnectionStrings:ryason %›”
DeleteCommand=”DELETE FROM [testimonial] WHERE [idTestimonial] = @idTestimonial
InsertCommand=”INSERT INTO [testimonial] ([firstName], [lastName], [email], [phone], [company], [website], [street], [city], [state], [zip], [testimonial], [phoneReference], [emailReference], [approved]) VALUES (@firstName, @lastName, @email, @phone, @company, @website, @street, @city, @state, @zip, @testimonial, @phoneReference, @emailReference, @approved)”
SelectCommand=”SELECT * FROM [testimonial] where idTestimonial=@idTestimonial

UpdateCommand=”UPDATE [testimonial] SET [firstName] = @firstName, [lastName] = @lastName, [email] = @email, [phone] = @phone, [company] = @company, [website] = @website, [street] = @street, [city] = @city, [state] = @state, [zip] = @zip, [testimonial] = @testimonial, [phoneReference] = @phoneReference, [emailReference] = @emailReference, [approved] = @approved WHERE [idTestimonial] = @idTestimonial“›
‹SelectParameters›
‹asp:ControlParameter ControlID=”gv” DefaultValue=”7″ Name=”idTestimonial” PropertyName=”SelectedValue” Type=”int32″ /›
‹/SelectParameters›
‹DeleteParameters›
‹asp:Parameter Name=”idTestimonial” Type=”Int32″ /›
‹/DeleteParameters›
‹UpdateParameters›
‹asp:Parameter Name=”firstName” Type=”String” /›
‹asp:Parameter Name=”lastName” Type=”String” /›
‹asp:Parameter Name=”email” Type=”String” /›
‹asp:Parameter Name=”phone” Type=”String” /›
‹asp:Parameter Name=”company” Type=”String” /›
‹asp:Parameter Name=”website” Type=”String” /›
‹asp:Parameter Name=”street” Type=”String” /›
‹asp:Parameter Name=”city” Type=”String” /›
‹asp:Parameter Name=”state” Type=”String” /›
‹asp:Parameter Name=”zip” Type=”String” /›
‹asp:Parameter Name=”testimonial” Type=”String” /›
‹asp:Parameter Name=”phoneReference” Type=”Boolean” /›
‹asp:Parameter Name=”emailReference” Type=”Boolean” /›
‹asp:Parameter Name=”approved” Type=”Boolean” /›
‹asp:Parameter Name=”idTestimonial” Type=”Int32″ /›
‹/UpdateParameters›
‹InsertParameters›
‹asp:Parameter Name=”firstName” Type=”String” /›
‹asp:Parameter Name=”lastName” Type=”String” /›
‹asp:Parameter Name=”email” Type=”String” /›
‹asp:Parameter Name=”phone” Type=”String” /›
‹asp:Parameter Name=”company” Type=”String” /›
‹asp:Parameter Name=”website” Type=”String” /›
‹asp:Parameter Name=”street” Type=”String” /›
‹asp:Parameter Name=”city” Type=”String” /›
‹asp:Parameter Name=”state” Type=”String” /›
‹asp:Parameter Name=”zip” Type=”String” /›
‹asp:Parameter Name=”testimonial” Type=”String” /›
‹asp:Parameter Name=”phoneReference” Type=”Boolean” /›
‹asp:Parameter Name=”emailReference” Type=”Boolean” /›
‹asp:Parameter Name=”approved” Type=”Boolean” /›
‹/InsertParameters›
‹/asp:SqlDataSource›

‹/asp:Content›

‹asp:Content ID=”Content2″ ContentPlaceHolderID=”rightcontent” Runat=”Server”›
‹/asp:Content›

{ 0 comments }

‹%@ Page Language=”C#” MasterPageFile=”~/MasterAdmin.master” AutoEventWireup=”true” CodeFile=”admin_testimonial.aspx.cs” Inherits=”admin_testimonial” Title=”Untitled Page” %›
‹asp:Content ID=”idContent” ContentPlaceHolderID=”leftcontent” runat=”server”

‹asp:sqldatasource id=”ds_view” runat=”server” connectionstring=”"›”
SelectCommand=”SELECT [idTestimonial], [company] FROM [testimonial]“›

‹/asp:SqlDataSource›

‹asp:GridView ID=”GridView1″ runat=”server”
AutoGenerateColumns=”False”
DataSourceID=”ds_view”
DataKeyNames=”idTestimonial”
SelectedIndex=”0″›
‹columns›
‹asp:templatefield›
‹itemtemplate›
‹asp:linkbutton commandname=”Select” runat=”server”›
‹%#Eval(”idTestimonial”) %›‹/asp:LinkButton›
‹/itemtemplate›
‹/asp:TemplateField›
‹/columns›

‹/asp:GridView›

‹asp:SqlDataSource ID=”ds_edit” runat=”server”
SelectCommand=”Select * from testimonial where idTestimonial=@idTestimonial” ConnectionString=”‹%$ ConnectionStrings:ryason %›”

‹selectparameters›
‹asp:controlparameter controlid=”GridView1″ name=”idTestimonial” propertyname=”SelectedValue”›
‹/selectparameters›
‹/asp:SqlDataSource›

‹asp:DetailsView ID=”details” DataSourceID=”ds_edit” runat=”server”
AutoGenerateRows=”false”
DataKeyNames=”idTestimonial”›
‹fields›
‹asp:templatefield›
‹headertemplate›Edit:‹/headertemplate›
‹itemtemplate›
‹asp:button commandname=”Edit” text=”Edit” runat=”server”›
‹/itemtemplate›
‹/asp:TemplateField›

‹asp:boundfield datafield=”idTestimonial” readonly=”true”›
‹/fields›
‹/asp:DetailsView›

‹/asp:Content›

{ 0 comments }

Vertical navigation menu using xml datasource

by Caroline Bogart on March 27, 2006

Q. How do I create a vertical navigation menu that has different contents than Web.sitemap?
A. The menu’s datasource is bound to an XmlDataSource. Its orientation is Vertical.

‹asp:Menu ID=”blogmenu” runat=”server”
Font-Size=”1px”
CssClass=”blogmenu”
DataSourceID=”ds_menu_blog”
StaticDisplayLevels=”1″
DisappearAfter=”0″
StaticMenuItemStyle-CssClass=”blogmenu”


‹DataBindings›
‹asp:MenuItemBinding
DataMember=”siteMapNode”
NavigateUrlField=”url”
TextField=”title”
ToolTipField=”description”
ValueField=”title”
Target=”_new”
Value=”title”
/›
‹/DataBindings›

‹/asp:Menu›

blogs.xml
‹?xml version=”1.0″ encoding=”utf-8″?›
‹siteMap xmlns=”http://schemas.microsoft.com/AspNet/SiteMap-File-1.0″›

‹siteMapNode url=”blogs.aspx”
title=”Blogs”
description=”blogs”›
‹siteMapNode url=”http://aspnetanswers.blogspot.com/”

title=”ASP.Net Answers”
description=”Bogart Computing, LLC” /›
‹siteMapNode url=”http://seo-web-marketing-programming.blogspot.com”
title=”SEO Programming”
description=”Bogart Computing, LLC” /›

‹/siteMapNode›
‹/siteMap›

{ 0 comments }

Q. How do I create a horizontal footer menu that has different contents than Web.sitemap?
A. The menu’s datasource is bound to an XmlDataSource. Its orientation is Horizontal.

web form

‹asp:Menu ID="Menu1" runat="server"
DataSourceID="ds_sitemap_footer"
DisappearAfter="0"
ItemWrap="True"
Orientation="Horizontal"
Width="800px"
DynamicHorizontalOffset="2" StaticDisplayLevels="2"

‹DataBindings›
‹asp:MenuItemBinding
DataMember="siteMapNode"
NavigateUrlField="url"
TextField="title"
ToolTipField="description"
ValueField="title" /›
‹/DataBindings›
‹/asp:Menu›

‹asp:XmlDataSource
ID="ds_sitemap_footer"
runat="server"
DataFile="~/footer.xml"
XPath="/*/*"
/›

footer.xml

‹?xml version="1.0" encoding="utf-8" ?›
‹siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" ›

‹siteMapNode url="Default.aspx"
title="Home"
description="Bogart Computing, LLC" ›

‹siteMapNode url="contact-nh-web-design-ecommerce-seo.aspx"
title="Contact"
description="Contact Bogart Computing"
/›

‹siteMapNode url="links-bogart-web-seo-design-programming.aspx"
title="Links"
description="Links" /›

‹siteMapNode url="bogart-computing-testimonials.aspx"
description="customer testimonials"
title="Testimonials" /›

‹/siteMapNode›
‹/siteMap›

{ 0 comments }

web.config Provider Declarative SqlDataSource

by Caroline Bogart on March 21, 2006

Q. How do I create a data-aware web control that automatically binds to the data?
A. Drag a datasource onto a form. Make it use your SQL Server/Database/Table. Make it generate SELECT, INSERT, UPDATE and DELETE commands. Save the connection string to web.config.

Put a SqlDataSource on a form.
Name it ds_yourDatasetName.

On the web design view, click the setup arrow to configure the database.
Choose New Connection.
Data Source: Microsoft SQL Server
Provider: .Net Framework Provider
Server Name: yourSqlServerName
Use Windows Authentication
Select the database: yourDatabaseName
Do you want to save the connection in the application configuration file?: yes. Save this string as: yourConnectionString.

Configure the Select statement:
Choose the table, select the columns.

Create the INSERT, UPDATE and DELETE statements:
If you click Advanced and the Statement Creation options are grayed out try adding a Primary Key to your table. Select Advanced, Generate INSERT, UPDATE, and DELETE statements.

Saving the connection string created this in web.config:

‹add name="yourConnectionString"
connectionString="Data Source=yourSqlServerName;
Initial Catalog=yourTable;
Integrated Security=True"
providerName="System.Data.SqlClient" /›

Put a data-aware (e.g., FormView) control on the form. Task menu, Choose Data Source: ds_yourDatasetName.

{ 0 comments }

Syndication and Aggregation

by Caroline Bogart on March 28, 2005

If you blogged in a forest and no one was there to read it, I promise you, your blog would make no noise.

e-marketing is about grabbing the target market consumers by their interests and reeling them right to your site. You’re writing a blog with lots of relevant content, and now you need to be found.

As a publisher, you syndicate or publish your blog content. As readers, your target market subscribes to your content. The Man In the Middle is The Aggregator, the service that accepts what you publish and sends it to those who want to read it.

  • You blog
  • Your bloging tool creates an xml version of your blog (called RSS or Atom)
  • You give the address of that xml to an aggregator (a service that gathers blogs)
  • The aggregator makes your blog available to subscribers. They call this a feed.
  • People interested in the content you write about subscribe to your feed.
  • The aggregator syndicates (publishes) the feed to the subscriber

Don’t worry if your eyes glaze at the thought of finding out how to do each of these steps. target=”_blank”>Bogart Computing offers RSS Syndication of your content as part of an overall effort to boost your site’s exposure to your target market.

{ 0 comments }