Patrick’s Bytes

Techie for the past 30 years…

Default to Edit mode in ASP.NET 3.5 ListView

ListView control gives you the flexibility of control the layout of your form. But when it comes to setting a Edit page using ListView such as the one for DetailView, you will realize it does not come with DefaultMode. For ListView you use the EditIndex property to set to something then the Edit view will be rendered by default.

<asp:ListView ID="ListView1" runat="server"
                DataSourceID="ContactInfoDataSource" EditIndex="0" >

Note that EditIndex is zero based, below is the explanation from MSDN

You can use the EditIndex property to programmatically specify or determine which item in a ListView control to edit. When this property is set to the index of an item in the control, that item is displayed in edit mode. In edit mode, the item is rendered by using the EditItemTemplate template instead of the ItemTemplate template. You can populate the EditItemTemplate with data-bound controls to enable users to modify values for the item. To switch from edit mode to display mode, set this property to -1.

FCKEditor themed aspnet error in file browser

According to the post here, If you are greeted with the following error when trying to upload files using the file manager:

Using themed css files requires a header control on the page. (e.g. <head runat="server" />).

You don’t need aspnet themes within the fckeditor folder, so simply add a web.config file in the folder, with the following content:

<configuration>

   <system.web>

      <pages styleSheetTheme=""> </pages>

   </system.web>

</configuration>

That would not work because it miss out another setting which is the ‘theme’ setting, so the correct settings would be as below:

<configuration>

   <system.web>

       <pages theme="" styleSheetTheme=""></pages>

   </system.web>

</configuration>

For FCKEditor, this web.config file need to be located in the same folder as the upload.aspx file.

I believe not just FCKEditor but also most of the ASP.NET project out there.

Free MS Press books

Psst… if you looking to learn more about LINQ, ASP.NET 3.5, Silverlight 2 or SQL Server 2008, check out this website where you can download the books for free. :)

ms_asp_net_cvrms_linq_cvr ms_silverlight_cvr

Free downloadable e-book offer- Introducing Microsoft Silverlight 2

ms_sql_srv_cvr

Free download- “Introducing SQL Server 2008” e-book offer

How to deploy a WCF web service project onto IIS6/7

clip_image002

In your webservice project, you have PrecompiledWeb folder, this folder contain the web service project in compiled form. Copy the content of the PrecompiledWeb, which is the CustomXmlService folder in this case to c:\inetpub\wwwroot

clip_image004

Now the folder is a website in the web server (but without the ability to run .NET code) so go to your IIS manager console to make this website to a web application. In the console you will see that you newly copied folder does not have a globe icon.

clip_image006

You can see the website in your Default Web Site, in IIS7 right click and select Convert to Application.

clip_image008

Still inside IIS7, a new window will pops up, click OK to accept the settings.

clip_image010

For IIS6 right click to open up the property page of the website

image

A new window will pops up, showing the default Directory tab

image

What you need to do is to click on the Create button on the lower half of the window

image

Click OK if you are not changing the application pool or execute permissions. Leave the permission at Scripts only.

To test out the web service, open it inside browser and the service description will come out.

clip_image012

In Visual Studio client project, delete your project Service Reference and add a new one pointing to this deployed web site.

clip_image014

Dynamic Languages coming to ASP.NET 3.5

Microsoft ASP.NET Team released a preview of dynamic languages support for ASP.NET 3.5 in Codeplex. That means languages like IronPython and IronRuby can be used to code ASP.NET pages, for example below is your ASPX page

<form id="form1" runat="server">
<div>
    Enter your name:<br />
    <asp:TextBox ID="TextBox1" runat="server">
    </asp:TextBox>
    <asp:Button ID="Button1" runat="server" Text="Button"
        OnClick="Button1_Click"/><br />
    <br />
    <asp:Label ID="Label1" runat="server" Text="Label">
    </asp:Label>
    <br />
</div>
</form>

You can have a Python code behind page for the Button1_Click event

<script runat="server">
def Page_Load(sender, e):
    if not IsPostBack:
        Label1.Text = "...Your name here..."

def Button1_Click(sender, e):
    Label1.Text = Textbox1.Text
</script>

Do download from Codeplex and have fun with it.

« Newer PostsOlder Posts »