findcontrol

How to find user control of an ASP.NET page inside of event of another user control on that ASP.NET page EDIT: different content placeholders?

房东的猫 提交于 2019-12-23 18:29:00
问题 I have a ASP.NET page with 2 user controls registered. The first one has only one button in it. The second one is simple text and hidden on default. What I want is to make the second one visible when the button in the first one is clicked (that is on button click event). ASP.NET page: <%@ Page Title="" Language="C#" CodeFile="test.aspx.cs" Inherits="test" %> <%@ Register Src="~/UC_button.ascx" TagName="button" TagPrefix="UC" %> <%@ Register Src="~/UC_text.ascx" TagName="text" TagPrefix="UC" %

how to add controls to the masterpage's content placeholder programmatically

萝らか妹 提交于 2019-12-22 01:14:31
问题 On the base.master: <%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Base.master.cs" Inherits="WebApplicationControlTest.Base" %> <!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>The title</title> <asp:ContentPlaceHolder ID="head" runat="server"> </asp:ContentPlaceHolder> </head> <body> <form id="form1" runat="server"> <div> There is a

asp.net FindControl Recursively

寵の児 提交于 2019-12-18 08:44:42
问题 This is a really weird one - I will do my best to explain. I have a basic master page: <%@ Master Language="VB" CodeFile="MasterPage.master.vb" Inherits="master_MasterPage" %> <!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></title> <asp:ContentPlaceHolder ID="head" runat="server"> </asp:ContentPlaceHolder> </head> <body> <form id="form1" runat=

asp.net FindControl Recursively

给你一囗甜甜゛ 提交于 2019-12-18 08:44:06
问题 This is a really weird one - I will do my best to explain. I have a basic master page: <%@ Master Language="VB" CodeFile="MasterPage.master.vb" Inherits="master_MasterPage" %> <!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></title> <asp:ContentPlaceHolder ID="head" runat="server"> </asp:ContentPlaceHolder> </head> <body> <form id="form1" runat=

can't find control in FormView?

拈花ヽ惹草 提交于 2019-12-18 06:57:58
问题 I need find this <a> tag resided in a FormView control, I need to remove this a tag depending on the condition but I can't find it using FormView.FindControl method <asp:UpdatePanel ID="upDiscipline" runat="server"> <ContentTemplate> <asp:FormView ID="fvMediaIntro" runat="server"> <ItemTemplate> <div class="clipControls"> <a runat="server" id="iNeedToFindThis" href="#">here</a> </div> </ItemTemplate> </ContentTemplate> </asp:UpdatePanel> I tried fvMediaIntro.FindControl() and fvMediaIntro.Row

ASP.NET Is there a better way to find controls that are within other controls?

本秂侑毒 提交于 2019-12-17 06:54:11
问题 I currently have a dropdown inside an ascx control. I need to "find" it from within the code behind on another ascx that is on the same page. It's value is used as a param to an ObjectDataSource on ascx #2. I am currently using this ugly piece of code. It works but I realize if the conrtol order were to change or various other things, it wouldn't be where I am expecting. Does anyone have any advice how I should properly be doing this? if(Page is ClaimBase) { var p = Page as ClaimBase; var

How do I find a ClientId of control in a Listview?

守給你的承諾、 提交于 2019-12-13 15:09:17
问题 This question is very similar to How do I find the Client ID of control within an ASP.NET GridView? However I'm using a listview and a label: <ItemTemplate> <asp:ImageButton ImageUrl="Resources/info.png" ToolTip="info" OnClientClick="toggle('<%#((label)Container).FindControl( "PresetUploadDescription").ClientID %>');" ID="Description" runat="server"/> <asp:Label ID="UploadDescription" BorderStyle="Solid" BorderColor="Goldenrod" BorderWidth="1" runat="server" Width="40em" CssClass="sc-Upload

OnCheckedChanged Nested Listview Controls

懵懂的女人 提交于 2019-12-13 03:18:25
问题 I have the following nested listview... <asp:ListView ID="lvwRiskQuestions" runat="server" ItemPlaceholderID="QuestionItemPlaceholder"> <LayoutTemplate> <asp:PlaceHolder ID="QuestionItemPlaceholder" runat="server" /> </LayoutTemplate> <ItemTemplate> <%# Eval("DESCRIPTION")%> <asp:ListView ID="lvwAnswers" runat="server" ItemPlaceholderID="AnswerItemPlaceholder" DataSource='<%# Eval("Answers")%>'> <LayoutTemplate> <asp:PlaceHolder ID="AnswerItemPlaceholder" runat="server" /> </LayoutTemplate>

How to find label control from content page which is inside master page of user control?

懵懂的女人 提交于 2019-12-12 17:30:50
问题 I have one page: Abc.aspx On this Abc.aspx page i have used one master page that is Master1.Master . Now on this master page i have rendered 1 usercontrol name as Usercontrol1.ascx. On this User control i have put 1 label named as lbl1. <asp:Label runat="server" ID="lbl1"></asp:Label> So now on page load event of Abc.aspx page i want to find this control and i have tried but getting null: protected void Page_Load(object sender, EventArgs e) { var lbl = ((Label)this.Master.FindControl("lbl1"))

find control in listview

点点圈 提交于 2019-12-12 02:25:15
问题 By pressing button in GridView i need to find control in Listview. <ItemTemplate> <td> <asp:Label ID="lblMarketLVBalanceHeader" runat="server" Text="Balance: "></asp:Label> </td> <td> <asp:Label ID="lblMarketLVBalanceValue" runat="server" Text='<%# Bind("Money", "{0:####}$") %>'></asp:Label> </td> </ItemTemplate> Code Behind: protected void GVMarketItems_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName.Equals("Buy")) { GridViewRow row = (GridViewRow)(((Button)e