findcontrol

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

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

Finding a certain cell in gridview through the use of column and row

I have a populated gridview that consist of template fields. I would like to find/check a certain number of cells using values of rows and columns. Eg: |Time|col1|col2|col3|col4|col5| |1200|------|-----|-----|------|-----| |1300|------| -X- |-----|------|-----| |1400|------|-----|-----|------|-----| lets say i have the value "130...

AssociatedControlId of inner namingcontainer

Hi, I have a custom control contains a label control. I want to set the AssociatedControlId of this label to be other control id on the page, but as soon as I implement the INamingContainer in my custom control, it will run into an error saying "Unable to find control with id 'abc' that is associated with the Label 'xyz'." This would be...

Understanding syntax in c#

I am hoping someone can help me understand what is going on in the code line below: Table t = (Table)Page.FindControl("Panel1").FindControl("tbl"); I understand Page.FindControl("Panel1").FindControl("tbl"); Why is there a (Table) before the Page.FindControl? ...

Can't find controls in FormView.InsertItemTemplate even on DataBound event

I have FormView in my page markup: <asp:FormView ruanat="server" ID="FormView1" DataSourceID="SqlDataSource1" OnDataBinding="FormView1_DataBinding" OnDataBound="FormView1_DataBound"> <InsertItemTemplate> <uc:UserControl1 runat="server" ID="ucUserControl1" /> </InsertItemTemplate> </asp:FormView> <asp:SqlDataSource runat="ser...

using findcontrol to find a control within a literalcontrol

hi there i have a custom control that renders a number of literalcontrols in the createchildcontrols method. as below (there are other lines of literalcontrols being added that i have not uncluded here) this.Controls.Add(new LiteralControl(string.Format("<input type=\"text\" style=\"display:none\" value=\"{0}\" id=\"{1}\" name=\"{1}\" ...

ValidationProperty not returning entered value for textbox in custom control

hi I have a custom control, (relevant code at the bottom) it consists of some text/links and a hidden textbox (rather than a hidden input). when rendered, the user via another dialog and some JS sets the value of the textbox to an integer and clicks submit on the form. i am trying to assure that the user has entered a number (via the JS...

How can I retrieve the values of controls in the form that posted?

I know this has got to be the simplest-sounding question ever asked about ASP.Net but I'm baffled. I have a form wherein my visitor will enter name, address, etc. Then I am POSTing that form via the PostBackUrl property of my Submit button to another page, where the fields are supposed to be all re-formed into new hidden fields, then P...

FindControl() from UserControl inside a for loop

I'm creating a usercontrol that will have a series of LinkButtons. I've declared all of my link buttons at the top of my class LinkButton LB1 = new LinkButton(); LinkButton LB2 = new LinkButton(); //... LinkButton LB9 = new LinkButton(); now I'd like to be able to create a loop to access all of those link buttons so I don't have to w...

ASP.NET C# DataList FindControl & Header/Footer template causes error

Hello, whenever I use the Header or Footer template of DataList, FindControl is unable to find a label part of the DataList, and throws a NullReferenceException. My SQLDataSource and DataList (no Header and Footer template - works): <asp:SqlDataSource ID="sdsMinaKop" runat="server" ConnectionString="<%$ ConnectionStri...

ASP.NET Panel FindControl within DataList to change property C#

I'm new to this ASP.NET stuff. In my page I have a Datalist with a FooterTemplate. In the footer I have a couple panels that will be visible depending on the QueryString. The problem I am having is trying to find these panels on Page_Load to change the Visible Property. Is there a way to find this control in the Page_Load? For example ...

How to find the one Label in DataList that is set to True

In my .aspx page I have my DataList: <asp:DataList ID="DataList1" runat="server" DataKeyField="ProductSID" DataSourceID="SqlDataSource1" onitemcreated="DataList1_ItemCreated" RepeatColumns="3" RepeatDirection="Horizontal" Width="1112px"> <ItemTemplate> ProductSID: <asp:Label ID="ProductSIDLabel" runat="ser...

FindControl table cell

I want to reference a table cell via it's string ID in my code like this FindControl("tdAnswer_a") because I am manipulating string ID names. The ASPX code looks like this : <table>...<td ID="tdAnswer_a" runat="server" visible="true"> But FindControl is not able to find the table cell. When I reference it by ID like this : tdAnswer_...

Where is my validator?

I have a validator in my page: <asp:RequiredFieldValidator ID="rfv1" runat="server" ControlToValidate="IdentifySEDSED1TxtDate" ErrorMessage="Significant Event Date 1 is missing" ValidType="SEDate">*</asp:RequiredFieldValidator> I found that in Page_Load: (below is a screen shot from the Watch Window) this.FindControl("rfv1") {Text...

findcontrol problems

why can not I do this I have a data list which retrieves some data out. if the label1 is we say 123 then a second label2 must be invisible Label Label1 = (Label)DataList2.FindControl("LabelName1"); Label Label2 = (Label)DataList2.FindControl("LabelName2"); if (Label1.Text == "123") { Label2.Visible = false; ...

Can't clear credentials textboxes on ASP.NET CreateUserWizard Control

I have a CreateUserWizard control using forms authentication on my login/create user page. I customized the CreateUserWizardStep1 so that I could add some additional validators. After successfully creating a user with the control and it displays "Complete Your account has been successfully created." I have added an additional button...

Avoid double control search in LINQ query

I have a Dictionary<string, bool> where key - control's ID and value - it's visible status to set: var dic = new Dictionary<string, bool> { { "rowFoo", true}, { "rowBar", false }, ... }; Some of controls can be null, i.e. dic.ToDictionary(k => this.FindControl(k), v => v) will not work because key can't be null. I can do ...

How to FindControl() in a GridView while in Edit mode?

I want to access controls and update database with their value. Notice using following code: void grdList_UpdateCommand(object source, GridCommandEventArgs e) { string str = ((RadTextBox)e.Item.FindControl("txtLookupItemValue")).Text; } I have access to control txtLookupItemValue, but it contains before-edit content, not actua...

ASP.NET Repeater template sub-control visibility before databind

I have a custom control which contains a Repeater control. The Repeater has an ItemTemplate. Inside that item template I have a panel which is going to hide something based on "IsEditable" a boolean property of the custom control. What I would like to do is set the panel's visibility once before the Repeater is databound. I know I could...

How does FindControl work in GridView?

I am trying to update a database using the GridView edit, update CommandField. I have two editable fields which are displayed as text boxes when in edit mode. When clicking submit, I am trying to put the text box values into variables to work with, but I am unable to access them. The two column names are "EOR" and "CategoryName". I have ...