findcontrol

Parent.FindControl() not working?

I have a page that has an iframe From one of the pages within the iframe I want to look back and make a panel on the default page invisible because it is overshadowing a popup I tried using Parent.FindControl but it does not seem to be working. I am positive I have the right id in the findcontrol because I used Firebug to inspect the p...

Saving GridViewRow data before changing it (Client Side)

Im working with C# 3.0, GridViews, so my idea is the following "Save actual data from gridviewA in some local var, then perform changes in real context and finally bind them all again in the same GridView": (steps) 1) I Have GridViewA with following columns : CodeClass Description Price Appointment 4798 Arthro Re...

GridView FindControl returns null when HeaderText is set

I have a GridView... <asp:GridView EnableViewState="true" ID="grdResults" runat="server" CssClass="resultsGrid" OnRowDataBound="grdResults_OnRowDataBound" AutoGenerateColumns="false" HeaderStyle-CssClass="header" OnRo...

How do I access a control in the HeaderTemplate of my GridView

I want to have a DropDownList in the header of my GridView. In My codebehind I can't seem to access it. Here is the HeaderTemplate: <asp:TemplateField SortExpression="EXCEPTION_TYPE"> <HeaderTemplate> <asp:Label ID="TypeId" runat="server" Text="Type" ></asp:Label> <asp:DropDownList ID="TypeFilter" runat="server" Auto...

How to find controls in a repeater header or footer

I was wondering how one would find the controls in the HeaderTemplate or FooterTemplate of an Asp.Net Repeater control. I can access them on the ItemDataBound event, but I was wondering how to get them after (for example to retrieve a value of an input in the header/footer). Note: I posted this question here after finding the answer ju...

FindControl in DataList Edit Mode

As a new .net/C# web begginner, I always get tripped up when I try to use FindControl. Blam -flat on my face. Here is my current FindControl problem: I have an .aspx page and Form, then ajax updatePanel, inside it there is my DataList (DataList1) that has an EditItemTemplate: that has the following: <EditItemTemplate> <asp:Label ID="th...

Index out of range error when using row.FindControl inside a Asp.net Gridview rowcommand event with Paging Enabled

The following code works great on Page 1 of data inside an Asp.net Gridview control: If e.CommandName = "Void" Then 'Read the status of the ticket currently Dim RowIndex As Integer = CInt(e.CommandArgument) Dim row As GridViewRow = grdTradeTickets.Rows(RowIndex) Dim lblTransactionID As Label = Dire...

ASP.Net FindControl is not working - How come?

I have used FindControl in the past, prior to .NET 2.0/3.0. It seems like now, for some reason, the ID's of my controls get a funky named assigned. For example I assigned an id "cbSelect" to a checkbox, but FindControl does not find it. When I view the HTML it was assigned ctl00_bodyPlaceHolder_ctl02_cbSelect. I have not found one ex...

Finding a Control in a page from a page base class

Hi Everyone. Hope you're having a good Friday and stuff... okay, so here's my question: All my ASPX pages inherit from a base class called BasePage. BasePage inherits from: System.Web.UI.Page Now, how do I access/set a control in my aspx page from my page base? I've tried this: HyperLink hypMainMenu = (HyperLink)Page.FindControl("...

Finding control within WPF itemscontrol

Hi i have few a single textbox within the the datatemplate for itemscontrol. When i binf the itemcontrols to a observable collection i get two text boxes. But i need to do some manipulations based on each of the text boxes for which i want to find each textbox seperatly using some id. Can anybody help on how to find a control witin the ...

e.Item.FindControl throws Object reference not set to an instance of an object.

Here is the part of Repeater code that throws exception... "Computer.Administrators" is StringCollection object. Debugger shows that "AdminsEnumerator.Current" gets correct string value but when "txtAdministrators.Text" tries to set value - exception is thrown. Please help with ideas. <asp:Repeater ID="repeatAdministrators" OnItemDataB...

Problem finding a control within a FormView from code-behind

Here the code behind... I'm trying to retrieve this control so I can add items to the drop down list (I'm retrieving the Role Groups to add to the drop down list in the code-behind) Protected Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim DDRoleGroups As DropDownList DDRoleGroup...

[ASP.NET] Access a content control in C# when using Master Pages

Good day everyone, I am building a page in ASP.NET, and using Master Pages in the process. I have a Content Place Holder name "cphBody" in my Master Page, which will contain the body of each Page for which that Master Page is the Master Page. In the ASP.NET Web page, I have a Content tag (referencing "cphBody") which also contains som...

Can't find control in edit mode in DataList

private void BindDataList() { int userId = Convert.ToInt32(ProfileInfo.GetUserID()); DataList1.DataSource = CatalogAccess.GetAddressByUserID(userId); DataList1.DataBind(); foreach (DataListItem item in DataList1.Items) { Label lbl = (Label)item.FindControl("lbl"); lbl.Text ...

Error while using subsonic scaffold = "Multiple controls with the same ID .. were found. FindControl requires that controls have unique IDs. "

I get this error when i try and edit a row on the tables that have keys connecting to the "AvailableHostname" table. All other tables edit fine. How can i fix this? Thank you so much for your help in advance. The error: Multiple controls with the same ID 'AvailableHostname' were found. FindControl requires that controls have unique IDs....

Problem finding web control inside of Gridview TemplateField

Okay, so I'm having issues getting the value of a DropDownList that's inside of a TemplateField when updating my GridView. Originally I was using the RowCommand event to check the command name and then performing the appropriate task (update/delete), but I had problems with the event firing twice, so I switched it out for separate event...

FindControl not finding dynamcily added user control in wizard control

I have a wizard control in wich I am adding a user control containing a simple table with some input fields based on users entry of how many children they have. ex: how many kids do you have so I add the user control ascx based on that loop that goes into step 5 of my wizard wich is also in a masterpage. I then use findcontrol to attte...

ASP.NET FormView.FindControl object reference error

I have a formview that has several textboxes inside of tr/td's. I'm trying to get the textboxes by using the .FindControl method but it's coming back null. The FormView is always in Edit mode (so I'm always in the EditItemTemplate) and i'm trying to load querystring values into the textboxes coming from the previous page so I do need t...

Nested Masterpages and .FindControl

On one site, I'm only using a single level Masterpage and in a page using that master, I can do this.Master.FindControl("controlName") to access the control. Works fine. However, using the same code on a site with two masterpage levels. MainMaster and SpecificMaster which has MainMaster as its Master. So on the page which uses Specif...

Using FindControl: Accessing Controls in a Formview

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 n...