findcontrol

Change text of a linkbutton in a repeater

末鹿安然 提交于 2019-12-07 23:08:21
问题 I have a repeater which displays comments related to a post. I want to add some functionality where when the user click on the link it goes from: report this post to post has been flagged how do I access the specific lnkButton? Obviously in ItemDataBound this is easily done, but in the click method I'm not sure how I would do it. Do I need to do something like: I tried something like this; LinkButton lb = repeater.FindControl(LINK_BUTTON_UNIQUE_ID) as LinkButton; lb.Text = "blah blah blah";

Using FindControl: Accessing Controls in a Formview

元气小坏坏 提交于 2019-12-07 04:03:46
问题 I'm developing a simple Wedding List application, where guests can reserve the present they want to buy for the bride and groom. The Reserve page wraps a few fields inside a couple of panels, all wrapped inside a FormView. The user enters their name, email and the quantity of items that they want to reserve, and the page will make the necessary reservations in the DB. My first problem was that in FormView_ItemCommand, I couldn't reference any of the other controls in the FormView.... I

c# - error using FindControl on div id

♀尐吖头ヾ 提交于 2019-12-03 12:42:29
I have an ASP.NET site that I am trying to access div elements by their ID from the C# code behind file. Essentially I want to see if a div element exists, and if so, alter its properties. I've found many resources out there that point to a dozen different solutions and none of them seem to work. HTML on ASP.Net Page: <div class="contentArea"> <div class="block" id="button1" runat="server"> Some Content Here </div> <div class="block" id="button2" runat="server"> Some Content Here </div> <div class="block" id="button3" runat="server"> Some Content Here </div> </div> C# Code Behind (examples I

ASPxGridView Find control (Checkbox) and Check if it is checked or not

允我心安 提交于 2019-12-02 22:13:35
问题 I have a checkbox (you can see below) nested in detailed grid. How can I find it on updating click and check if checked or not? I'm using DevExpress GridView <dxwgv:GridViewDataCheckColumn Visible="false" VisibleIndex="14"> <EditFormSettings Visible="True" /> <EditItemTemplate> <dxe:ASPxCheckBox ID="ASPxCheckBox1" Text="" runat="server"> </dxe:ASPxCheckBox> </EditItemTemplate> </dxwgv:GridViewDataCheckColumn> 回答1: Protected Sub grid_RowInserting(ByVal sender As Object, ByVal e As DevExpress

ASPxGridView Find control (Checkbox) and Check if it is checked or not

纵然是瞬间 提交于 2019-12-02 12:30:57
I have a checkbox (you can see below) nested in detailed grid. How can I find it on updating click and check if checked or not? I'm using DevExpress GridView <dxwgv:GridViewDataCheckColumn Visible="false" VisibleIndex="14"> <EditFormSettings Visible="True" /> <EditItemTemplate> <dxe:ASPxCheckBox ID="ASPxCheckBox1" Text="" runat="server"> </dxe:ASPxCheckBox> </EditItemTemplate> </dxwgv:GridViewDataCheckColumn> Estrella Protected Sub grid_RowInserting(ByVal sender As Object, ByVal e As DevExpress.Web.Data.ASPxDataInsertingEventArgs) Handles grdProyectos.RowInserting Dim grid As ASPxGridView =

Find control in ListView EmptyDataTemplate

一世执手 提交于 2019-11-30 17:48:00
I have the a ListView like this <asp:ListView ID="ListView1" runat="server"> <EmptyDataTemplate> <asp:Literal ID="Literal1" runat="server" text="some text"/> </EmptyDataTemplate> ... </asp:ListView> In Page_Load() I have the following: Literal x = (Literal)ListView1.FindControl("Literal1"); x.Text = "other text"; but x returns null . I’d like to change the text of the Literal control but I don’t have no idea how to do it. Mcbeev I believe that unless you call the DataBind method of your ListView somewhere in code behind, the ListView will never try to data bind. Then nothing will render and

Finding user control in TemplateField of DetailsView

一个人想着一个人 提交于 2019-11-30 09:30:18
问题 I have a DetailsView that I'm posting back - and inside of that is a UserControl. I'm having some difficulty located it in the postback data. As an example: <asp:DetailsView ID="dvDetailsView" runat="Server" AutoGenerateRows="false"> <Fields> <asp:TemplateField> <ItemTemplate> Some text here </ItemTemplate> <EditItemTemplate> <uc:UserControl ID="ucUserControl" runat="server" /> </EditItemTemplate> <InsertItemTemplate> <uc:UserControl ID="ucUserControl" runat="server" /> </InsertItemTemplate>

Find control in ListView EmptyDataTemplate

十年热恋 提交于 2019-11-30 01:50:33
问题 I have the a ListView like this <asp:ListView ID="ListView1" runat="server"> <EmptyDataTemplate> <asp:Literal ID="Literal1" runat="server" text="some text"/> </EmptyDataTemplate> ... </asp:ListView> In Page_Load() I have the following: Literal x = (Literal)ListView1.FindControl("Literal1"); x.Text = "other text"; but x returns null . I’d like to change the text of the Literal control but I don’t have no idea how to do it. 回答1: I believe that unless you call the DataBind method of your

Using FindControl() to find control

ε祈祈猫儿з 提交于 2019-11-30 01:29:37
问题 I have a Literal control that I am trying to locate so I can insert text into it. I have a Master page that contains several content placeholders. <asp:Content ID="Content7" ContentPlaceHolderID="MainLinks" runat="server"> <h3>Project Navigation</h3> <ul class="rightColBoxNav"> <asp:Literal ID="litNavLinks" runat="server" /> </ul> </asp:Content> I keep getting "Object reference not set to an instance of an object." How do I locate this object so I can find and update it? I have tried: (

Using FindControl to get GridView in a Content Page

被刻印的时光 ゝ 提交于 2019-11-29 16:27:44
I would like to find a GridView Control within a separate class and I am having issues doing so. I even tried placing my code in the aspx.cs page to no avail. I keep getting Object reference not set to an instance of an object. I'm sure there is a simple step I'm missing, but in my research I cannot seem to find anything. Aspx code <asp:GridView ID="GridView1" EnableViewState="true" runat="server" BackColor="White" BorderColor="#CC9966" BorderStyle="None" BorderWidth="1px" CellPadding="4" Width="933px" onrowdatabound="GridView1_RowDataBound" onrowdeleting="GridView1_RowDeleting" onrowediting=