C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




How to run ascx page?


Posted Date: 07 Sep 2008      Total Responses: 2

Posted By: gandhi       Member Level: Silver     Points: 1



Dear all the following coding is working fine in aspx page the same coding i run in ascx page cannot run that time display this error
"directory listing --/calculation/" how to solve this problme

my coding is below

calculation.ascx (Design page)

<%@ Control Language="VB" AutoEventWireup="false" CodeFile="calculation.ascx.vb" Inherits="calculation" %>
<table>
<tr>
<td style="width: 100px">
<asp:Label ID="Label1" runat="server" Text="Enter First Value" Width="104px"></asp:Label></td>
<td style="width: 32px">
</td>
<td style="width: 100px">
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td style="width: 100px">
<asp:Label ID="Label2" runat="server" Text="Enter Second Value" Width="128px"></asp:Label></td>
<td style="width: 32px">
</td>
<td style="width: 100px">
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td style="width: 100px">
<asp:Label ID="Label3" runat="server" Text="Result"></asp:Label></td>
<td style="width: 32px">
</td>
<td style="width: 100px">
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td style="width: 100px">
<asp:Button ID="Button1" runat="server" Text="Addition" /></td>
<td style="width: 32px">
<asp:Button ID="Button2" runat="server" Text="Subtraction" /></td>
<td style="width: 100px">
<asp:Button ID="Button3" runat="server" Text="Division" /></td>
</tr>
</table>


calculation.ascx.vb
Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Configuration
Imports Microsoft.ApplicationBlocks.Data

Partial Class calculation
Inherits System.Web.UI.UserControl

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
TextBox3.Text = TextBox1.Text + TextBox2.Text
End Sub

Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
TextBox3.Text = TextBox1.Text - TextBox2.Text
End Sub

Protected Sub Button3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button3.Click
TextBox3.Text = TextBox1.Text / TextBox2.Text
End Sub
End Class







Responses

Author: Satya    07 Sep 2008Member Level: GoldRating:     Points: 2

Hi,

You have to link this user control to an .aspx page using the Resgister page directive.

See the following link for more info.
http://www.asp101.com/lessons/usercontrols.asp



Author: AbidiP    08 Sep 2008Member Level: GoldRating:     Points: 3

you cant run ascx page directly as aspx page bcoz ascx is user control.

open aspx page and drag & drop ur ascx on it and try to run that aspx page

bye



Post Reply
You must Sign In to post a response.
Next : what purpose used ? = {0} in link?
Previous : Grid Align
Return to Discussion Forum
Post New Message
Category: ASP.NET

Related Messages



dotNet Slackers   BizTalk Adaptors    Web Design


Contact Us    Privacy Policy    Terms Of Use