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
1 answer

How to get items row id of repeater when user clicks rows linkbutton control

I have a repeater, nested with Html table rows:
perlynsparks
  • 401
  • 3
  • 7
  • 20
1
vote
0 answers

.FindControl not working from my C#

I want to set some of my controls in a FormView manually and some from a SQL Data Source. Here is the snippet of my code:
Ben Clarke
  • 256
  • 1
  • 6
  • 23
1
vote
1 answer

Capture edit mode through checking the standard tool bar

I'm using this code to check if the standard toolbar is deactivated in the edit mode. CommandBarControl oNewMenu = Application.CommandBars("Worksheet Menu Bar").FindControl(1, 18, 1, True, True) If (IsNull(oNewMenu)) Then MsgBox "Edit mode…
Srimal
  • 11
  • 1
1
vote
3 answers

Set Custom ASP.NET UserControl variables when its in a Repeater

<%@ Register Src="~/Controls/PressFileDownload.ascx" TagName="pfd" TagPrefix="uc1" %>
tnriverfish
  • 713
  • 2
  • 11
  • 19
1
vote
3 answers

How to find label controls in an asp.net page

I have some label controls in a panel with id ResultsPanel. To find the label controls on the page, I did the following: for (int ctr = 0; ctr < lblString.Length - 1; ctr++) { //string labelID = string.Format("lblResult{0}", ctr); int mylbl…
Guzzyman
  • 561
  • 6
  • 16
  • 37
1
vote
2 answers

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

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…
Hcabnettek
  • 12,678
  • 38
  • 124
  • 190
1
vote
1 answer

Finding HtmlGenericControl

I'm trying to set two variables to two respective controls, and my current code isn't working. What is the correct syntax? ascx code:
dmr
  • 21,811
  • 37
  • 100
  • 138
1
vote
1 answer

FindControl not working in Shared Sub

I have researched the FindControl call but nothing I have found mention the Public Shared Sub problems. I am using an aspx page and it's code-behind in vb.net. I am not using a Master page. I am already using FindControl successfully on this page in…
Susan O
  • 65
  • 1
  • 8
1
vote
2 answers

Get Values in GridView textbox TemplateField

I have an asp.net page called Default.aspx, and it's master page is Site.master. In the Default.aspx, i added a gridview with 3 databound fields and 1 Templatefield, and then, dragged a TextBox inside this templatefield. I'm trying to get the…
Diego Oliveira
  • 63
  • 1
  • 3
  • 8
1
vote
1 answer

Call UserControl function from Page's Page_Load event

I have a UserControl that functions as a template for a FormView, But depending on whether it is in edit or insert mode, one of the TextBox controls needs to be disabled. I added a function to the UserControl public bool IsInsert { get { return…
Jenius
  • 174
  • 15
1
vote
4 answers

FindControl method cannot locate the control on the page

Ive tried searching for hours now and cannot find out why my code (aka, me.) is failing Basically... I have a listview control which I'm passing a datatable of products (ID, Name, Description and Price columns), and im trying to make it so that when…
anthonyvscode
  • 995
  • 8
  • 15
1
vote
1 answer

How to get textbox value from datalist?

I am using datalist to show product id, name and a textbox("Qty") allow user to input order Qty. I got System.NullReferenceException: Object reference not set to an instance of an object error when user click an item to order. My datasource…
user1698255
  • 75
  • 1
  • 2
  • 10
1
vote
2 answers

How to find a panel and add control to it from it's code behind

In a master page I got a panel which I want to add controls to it from the master page's code behind as follow: var cphRegionName = this.Page.FindControl("pnlLeft") as Panel; cphRegionName.Controls.Add(uc); but I get this error: Object reference…
Kardo
  • 1,658
  • 4
  • 32
  • 52
1
vote
1 answer

is there better ways to get gridview values?

for gridviews, how can i get the cell values as well as column names from it when click on a button and this button sometimes can be embedded within a gridview row also can be outside the gridview somewhere else on the page. my stupid and simple way…
Tiger
  • 139
  • 1
  • 3
  • 12
1
vote
0 answers

How to upload file through dynamically generated FileUpload control using dynamically generated button?

How can I upload a file through a dynamically generated file upload control and a click on the dynamically generated button's event? Following is the code I have tried, but it's not working: void UpLdButton_Click(object sender, EventArgs e) { …
Nishant SB
  • 67
  • 2
  • 16