Click here to Skip to main content
15,902,112 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: How to handel NULL referance Pin
Brij14-Jul-09 20:20
mentorBrij14-Jul-09 20:20 
AnswerRe: How to handel NULL referance Pin
Vimalsoft(Pty) Ltd14-Jul-09 20:33
professionalVimalsoft(Pty) Ltd14-Jul-09 20:33 
Questionhow to call a method of one user control in another user control Pin
lakshmichawala14-Jul-09 18:47
lakshmichawala14-Jul-09 18:47 
AnswerRe: how to call a method of one user control in another user control Pin
Vimalsoft(Pty) Ltd14-Jul-09 20:36
professionalVimalsoft(Pty) Ltd14-Jul-09 20:36 
GeneralRe: how to call a method of one user control in another user control Pin
lakshmichawala14-Jul-09 21:05
lakshmichawala14-Jul-09 21:05 
GeneralRe: how to call a method of one user control in another user control Pin
Vimalsoft(Pty) Ltd14-Jul-09 21:09
professionalVimalsoft(Pty) Ltd14-Jul-09 21:09 
GeneralRe: how to call a method of one user control in another user control Pin
lakshmichawala14-Jul-09 21:18
lakshmichawala14-Jul-09 21:18 
GeneralRe: how to call a method of one user control in another user control Pin
Vimalsoft(Pty) Ltd14-Jul-09 21:54
professionalVimalsoft(Pty) Ltd14-Jul-09 21:54 
Good Morning lakshmichawala

I will show you an Example of how you do it. i will create a Small Example.

First i will create a usercontrol and name i U1 like and it will have a method that will display a string like this

cs will look like this

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class U1 : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    public String Message()
    {
        return "Message from U1 User control";
    }
}


and the html will be like this

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="U1.ascx.cs" Inherits="U1" %>
<asp:Label ID="lblU1" runat="server" Text="Usercontrol 1"></asp:Label>


and second thing is to create a Second user control and name it U2
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="U2.ascx.cs" Inherits="U2" %>
<%@ Register src="U1.ascx" tagname="U1" tagprefix="uc1" %>
<asp:Label ID="lblU2" runat="server" Text="User Control 2"></asp:Label>

<p>
    &nbsp;</p>
<p>
    &nbsp;</p>
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />


as you can see i have registered the U1 and in my U2 i can use the Function that i have made public like this in the button click

protected void Button1_Click(object sender, EventArgs e)
 {
     U1 obj = new U1();

     String Message;

     Message = obj.Message();

     Response.Write(Message);

 }




and a hardcoded message will come from the U1.

Hope this helps

Thanks

Vuyiswa Maseko,

Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."

C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.somee.com
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/

GeneralRe: how to call a method of one user control in another user control Pin
DoctorMick15-Jul-09 1:07
DoctorMick15-Jul-09 1:07 
QuestionHow to get back up from database using asp .net & C# Pin
Suhachi14-Jul-09 18:20
Suhachi14-Jul-09 18:20 
AnswerRe: How to get back up from database using asp .net & C# Pin
Abhijit Jana14-Jul-09 18:28
professionalAbhijit Jana14-Jul-09 18:28 
QuestionRe: How to get back up from database using asp .net & C# Pin
Suhachi14-Jul-09 22:14
Suhachi14-Jul-09 22:14 
AnswerRe: How to get back up from database using asp .net & C# Pin
ScottM115-Jul-09 22:16
ScottM115-Jul-09 22:16 
QuestionProblem with retrieving information from Data Pin
Sider8914-Jul-09 9:19
Sider8914-Jul-09 9:19 
AnswerRe: Problem with retrieving information from Data Pin
Not Active14-Jul-09 10:59
mentorNot Active14-Jul-09 10:59 
AnswerRe: Problem with retrieving information from Data Pin
Christian Graus14-Jul-09 11:54
protectorChristian Graus14-Jul-09 11:54 
AnswerRe: Problem with retrieving information from Data Pin
Sider8914-Jul-09 20:17
Sider8914-Jul-09 20:17 
QuestionSecuring Web Pages in ASP.NET Pin
chintanstrings14-Jul-09 9:12
chintanstrings14-Jul-09 9:12 
AnswerRe: Securing Web Pages in ASP.NET Pin
Brij14-Jul-09 9:20
mentorBrij14-Jul-09 9:20 
AnswerRe: Securing Web Pages in ASP.NET Pin
Abhijit Jana14-Jul-09 9:24
professionalAbhijit Jana14-Jul-09 9:24 
GeneralRe: Securing Web Pages in ASP.NET Pin
chintanstrings14-Jul-09 9:32
chintanstrings14-Jul-09 9:32 
GeneralRe: Securing Web Pages in ASP.NET Pin
Abhijit Jana14-Jul-09 9:42
professionalAbhijit Jana14-Jul-09 9:42 
Questionhow to make source code uneditable Pin
ashutosh_karna14-Jul-09 8:39
ashutosh_karna14-Jul-09 8:39 
AnswerRe: how to make source code uneditable Pin
Abhijit Jana14-Jul-09 8:45
professionalAbhijit Jana14-Jul-09 8:45 
GeneralRe: how to make source code uneditable Pin
N a v a n e e t h14-Jul-09 16:16
N a v a n e e t h14-Jul-09 16:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.