find dropdownlist of on usercontrol1 on another user control usercontrl2

Posted by Sushant under ASP.NET on 6/13/2013 | Points: 10 | Views : 1000 | Status : [Member] | Replies : 3
how to find dropdownlist of on usercontrol1 on another user control usercontrl2


plz help

Sushat


Responses

Posted by: Rickeybglr on: 6/13/2013 [Member] Starter | Points: 25

Up
0
Down
please explain ur problem in brief

Sushant, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Allemahesh on: 6/13/2013 [Member] [MVP] Silver | Points: 25

Up
0
Down
You can use the below code:-

User Control 1 : WebUserControl.ascx
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="WebUserControl.ascx.cs" Inherits="UserControls_WebUserControl" %>
<asp:DropDownList ID="ddl1" runat="server">
</asp:DropDownList>


User Control 2 : WebUserControl2.ascx
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="WebUserControl2.ascx.cs"
Inherits="UserControls_WebUserControl2" %>
<%@ Register TagPrefix="uc" TagName="Spinner" Src="~/UserControls/WebUserControl.ascx" %>
<uc:Spinner id="Spinner1" runat="server" />


Code to find the control:- Write this code in WebUserControl2.ascx.cs file
UserControls_WebUserControl obj = new UserControls_WebUserControl();
DropDownList list = (DropDownList)obj.FindControl("ddl1");

Hope this help you.


Sushant, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sushant on: 6/14/2013 [Member] Starter | Points: 25

Up
0
Down
Does not work man

Sushat

Sushant, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response