Questions tagged [findcontrol]

A method on the Control class in the .NET framework that finds a control from its id. The control is only found if it is within the calling control's naming container.

374 questions
1
vote
3 answers

Finding an ascx control inside aspx

I'm finding a dropdown in an ascxcontrol on my aspx in the following way. Dim cp As ContentPlaceHolder = DirectCast(Page.Form.FindControl("ContentPlaceHolder1"), ContentPlaceHolder) Dim ascx As UserControl = DirectCast(cp.FindControl("drpType"),…
Arno
  • 55
  • 7
1
vote
3 answers

FindControl and INamingContainer

I want to word this question carefully, so helpful people don't jump in and spend their time telling me information that I already know (I don't want to waste their time). I want to understand how FindControl works in ASP.NET web application…
onefootswill
  • 3,707
  • 6
  • 47
  • 101
1
vote
4 answers

FindControl not working for dynamically created user control

I am dynamically creating a databound DropDownList control and adding it to placeholder in a databound Repeater control which is a custom user control placed on a page with tabs. The Id of the DropDownList is set dynamically, and for the generated…
Ash Machine
  • 9,601
  • 11
  • 45
  • 52
1
vote
2 answers

How to find a control inside an asp.net calendar control

After adding a control in the dayrender event, is there a way to find the control later? I have tried calendar.FindControl("lblSample") but without success. Here is some of my code to be more clear: protected void calSample_DayRender(object…
stillsmallvoice
  • 523
  • 1
  • 7
  • 17
1
vote
1 answer

Equivalent to jQuery closest() in ASP.NET Web Forms

Im trying to figure out a way to build a somewhat clever version of the jQuery closest method in C#. Im using a generic method to find the desired control and then index the control chain public static T FindControlRecursive(Control control,…
Eric Herlitz
  • 25,354
  • 27
  • 113
  • 157
1
vote
2 answers

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…
codethrift
  • 2,337
  • 4
  • 17
  • 16
1
vote
1 answer

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)…
Doug
  • 125
  • 2
  • 11
  • 22
1
vote
1 answer

DetailsView image updating problem

I have DetailsView with users Info (Name, Email, Picture). That DetailsView control can be edited. Values are from DataBase protected void DVUserInfoShow_ItemUpdating(object sender, DetailsViewUpdateEventArgs e) { FileUpload EditAvatar =…
RaShe
  • 1,851
  • 3
  • 28
  • 42
1
vote
1 answer

Repeater headertemplate find

I am trying to add an attribute to a tag with ID 'SubNav2' on ItemDataBound which is in the HeaderTemplate of a repeater. But I keep getting the error: Object reference not set to an instance of an object. Which i think is because it is not finding…
Jammer
  • 2,330
  • 11
  • 48
  • 77
1
vote
2 answers

using JavaScript, find the ClientID of .NET control nested deep within a master page

The short question: *takes deep breath* How I can ClientID of TableRow inside Table added to PlaceHolder, which is in a UserControl inside a Web Part added to a SharePoint page using a MasterPage? The explanation: I'm building a usercontrol that…
QMKevin
  • 1,101
  • 3
  • 13
  • 26
1
vote
3 answers

Find usercontrol panel in parent page using jquery

How can I find a panel defined in usercontrol from its parent page using jquery? like the equivalent of document.getElementById('<%= UserControl.FindControl("pnlInputs").ClientID %>') in jquery
user648610
  • 121
  • 1
  • 5
  • 8
1
vote
2 answers

Why do I get an access violation when I access a TValueListEditor found with FindControl?

I have dynamically created TValueListEditor VCL component on a TForm. The code is located in nested procedure of one of the main form's methods. I have set: ValueListEditor.KeyOptions := [keyEdit, keyAdd, keyUnique]; It looks like…
HX_unbanned
  • 583
  • 1
  • 15
  • 51
1
vote
0 answers

FindControl in Gridview is empty with Framework 4.5.2, with Framework 4 is working

I add checkboxes on RowDataBound in a Gridview: for (int i = 1; i < e.Row.Cells.Count; i++) { CheckBox cb = new CheckBox(); cb.ID = "Checkbox" + i.ToString(); if (e.Row.Cells[i].Text ==…
Kᴀτᴢ
  • 2,146
  • 6
  • 29
  • 57
1
vote
0 answers

RadioButtonList FindControl always finds itself regardless of find parameter

I am iterating through controls to find controls to disable based on some settings. This is very old .net 1.1 code which worked fine until I upgraded it to 2.0 (and then 4.5). And there is only an issue with the RadioListButton. The FindControl…
1
vote
1 answer

Why can't I change the display of Edit and Delete buttons in GridView?

In VB.Net I am using a gridview to display some information. For this gridview, I am using the ItemTemplate and the EditItemTemplate. What I want to do is stop the user from being able to click the Edit or Delete buttons of another row while the are…
billy_blanks
  • 105
  • 1
  • 3
  • 12