.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

accessing form view binded control from child control

Posted By:      Posted Date: September 15, 2010    Points: 0   Category :ASP.Net
I am using a form view control which has two binded textbox. Now at this level it works fine and the textboxes show the values from database. But when i insert a panel inside the form view and move these two textboxes inside the panel, they dont show any values. What could be the reason for this? Thanks!

View Complete Post

More Related Resource Links

Accessing the selected value of a dropdownlist control in a Form View


I need to verify the selection in a dropdown list control is not a certain value.  It is in the edit mode of a formview.

just to verify that I could access it I tried to put the value in a label,  however it is always empty:


this is what I used

  'Dim droplist5 As DropDownList = DirectCast(FormView1.Row.FindControl("DropDownList5"), DropDownList)


            LabelHeaderwarning.Text = droplist5.SelectedValue.ToString


I also tried the validation controls but they don't seem to work with a drop down control.


Any suggestions on this would be extremely helpful



Accessing data in a dymaic form control.

I have a page that will generate upto 10 copies of some web controlls, depending on how many the user wants, but I am not sure on how to access the data the user enters into it. The code  I have is: protected void ddlAmountToAdd_SelectedIndexChanged(object sender, EventArgs e) { //Create a for loop to generate and add all the form fields then add them to the pannel for (byte i = 2; i <= Convert.ToByte(ddlAmountToAdd.SelectedValue); i++) { Label lblGameName = DynamicControlCreator.Label("lblGameName" + i, "Game Name: "); TextBox tbGameName = DynamicControlCreator.TextBox("tbGameName" + i); Label lblReleaseDate = DynamicControlCreator.Label("lblReleaseDate" + i, " Release Date (MM/DD/YYYY): "); TextBox tbReleaseDate = DynamicControlCreator.TextBox("tbReleaseDate" + i); Label lblRegion = DynamicControlCreator.Label("lblRegion" + i, " Region: "); DropDownList ddlRegion = DynamicControlCreator.DropDownList("ddlRegion" + i, Regions); Label lblRegionOther = DynamicControlCreator.Label("lblOtherRegion" + i, " Other: "); TextBox tbRegionOther = DynamicControlCreator.TextBox("tbOtherRegion" + i); Labe

windows form control library unable to view in client pc


Hi all,

i have another problem regarding the windows form control library.

recently i test the program in my own pc, the windows form control is running.

but when i try access my project in local network client pc, the windows form control doesn't show.

it just an empty.

may i know what is the problem?

My project is embedded the windows form control in aspx.

i got the cache in client pc, the windows form dll have inside the cache and also the client pc have .net framework install.

in my own pc, i also disable my firewall.

the result still same, the control cannot show on client pc.

Anyone can help me?


Solution to controlling the Redirect URL after saving content in a Data Form View Control



I have customized a Page Layout to include a custom Data Form View Web Part that will allow users to enter comments on a news story page in a publishing site.


I was having a difficult time because when I clicked the button to save the data to the list, everything saved correctly, but the control was redirecting me to the AllItems.aspx page of the list.  This wasn't the desired behavior since the end user would prefer to see that their comment was posted on the news story page and wouldn't know what the AllItems.aspx page was for.


The save button that was created in the XSL seciton of the web part was:


<SharePoint: SaveButton runat="server" ControlMode="New" id="savebutton1" />


Microsoft has documented a RedirectUrl property on this button that I figured could change what page was loaded after the user saved the form data.  However, try as I might I could not get it to work.


Some more searching lead me to this article:


Accessing the different controls inside a GridView control

how we can access a particular control which resides inside a GridView control. In this article I will show you how you can access different controls inside a GridView control. We will see how we can access a TextBox control, a DropDownList control and a ListBox control. If you are working with ASP.NET 1.X then you might want to check out my article Accessing Different Controls Inside a DataGrid.

GridView control to show master-child or master-slave data, written in c#, asp.net

I previously made a master slave datagrid using Visual Studio 2003 .Net (original article) that would allow users to show data to clients using collapse and expand features. These features however did not carry over to gridview for many users. This tutorial will explaing how to create a collapsable/expandable gridview in frameworks 2.0 and higher

Custom Control Design view error



I have created a custom control from scratch and it works fine as in you can build the project that uses it and it works fine at runtime. Problem is when you go to design view the control shows an error in the place of where the control should be rendered.

Error: '<SomeValue>' Could not be set to '<SomeProperty>'

This shows up on all my custom set properties. These properties are created as basic as possible. I can give the properties values in Source view and run the app just fine. I can even add a Onclick event. If I don't set any custom properties the control will render fine in Design view. It's only when I set a value to a custom property.

Property Code Example:

public string Text
                string ret = "";
                object obj = ViewState["Text"];
                if (obj != null)
                    ret = obj.ToString();
                return ret;
                ViewState["Text"] = value;

I've even removed the Category and Description tags with no difference.

I don't know if what I said makes sens, but I hope it

Child control in Repeater



     I am trying to find a child control from a repeater control's child control. I have the following structure like a top control is a repeater, below which is a Panel and below this is a DateControl(custom control).

I want to find the DateControl.

<asp:Repeater runat="server"
                       <asp:Panel ID="pnlAddDependent"

                                  <xyz:DateControl runat="server" ID="dfDepBirthDate"


When iam trying like this, i am getting the "Object Reference not set error". Please help, it is urgent.

if (this.rptMembers.FindControl("pnlAddDependent").FindContro

User Control not accessing the value of the properties send to it from the aspx page.


I have a dynamic accordion on a page. Set its datasource to an object of paged data source.The user control is in the accordions content template. When i was writing code the properties were showing but after giving the values of databases as


<uc:UserControl1  runat="server" Property1='<%#DataBinder.Eval(Container.DataItem,"columname1")%>' Property2='<%#DataBinder.Eval(Container.DataItem,"columname2")%>'  ></uc:UserControl1>


but the values shows null, these properties are shown as textboxes text property by user control.

MoreOver when I checked the values of database Items.So i made a textbox instead of usercontrol here as

<asp:TextBox ID="txtTest" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"Columname1")%>'></asp:TextBox>

It is showing the correct value. And if i pass the value directly it is also showing correctly like

<uc:UserControl1  runat="server" Property1="XYZ")%>' Property2="ABC")%>'  ></uc:UserControl1>

. where I am wrong

the problem is eval is not passing the value to usercont

Accessing Label Control In a listview using Javascript



I have a Button and Label nested inside a ListView.

When a User clicks the button i want the Label to display a specific value eg"Pass". Of course being a Listview the Label value will be relevant to the row the button was clicked on.

I want all this to happen on client side, but i am struggling to access the Label via my Javascript??

Any suggestions and examples Would be much appreciated..

Applying custom CSS to the MOSS 2007 Calendar control Month view



I have a requirement to use the MOSS 2007 Calendar Control - month view is to apply a custom css to have a look and feel as per our requirements.

We tried applying the custom css to the MOSS 2007 calendar control - month view, it does take the custom css and applies it, but when i click on any date and come back to the calendar control, it changes the CSS of the MOSS calendar control back to the default one.

Let me know if anyone has any suggestion on  how to customize the calendar control for css for our intranet application.

Your response would be highly appreciated.






Templates in MVC 2 View User Control?


Is there a way to create templates in an MVC 2 View User Control much like the ability of a Web User Control? or should I just use a Web User Control? With MVC 2, should Web User Controls be avoided?

How I disable vertical scroll bar of report viewer control on Web Form.


I'm displaying .rdlc report file using Report viewer control on Webform. If  I Fix height of viewer control and data is not same as to size of viewer control then it display one scrollbar on viewer control and second vertical scroll bar is coming on webpage.

 I want to off viewer vertical scrollbar or in simple word's I don't want to display two scroll bar with my report. Please guide me or send me reference if any.


Accessing a row's dropdownlist values AFTER the gridview control is in Edit mode

Hello, I have a gridview control. When it goes into Edit mode, there are 3 dropdownlists in one cell that are populated by separate stored procedures during the RowDataBound event. The 1st dropdownlist's value is used as a parameter to determine what the 2nd dropdownlist is populated with. The 2nd dropdownlist's value is used as a parameter to determine what the 3rd dropdownlist is populated with. Everything works fine when the row is first put into Edit mode. While I'm in Edit mode and I change the selection in the 1st dropdownlist, how do I access the control so I can feed this new parameter to the 2nd dropdownlist? I have the first 2 dropdownlists set for AutoPostBack so that the Page_Load event is fired when the user changes a value. I know how to get access to these controls via the FindControl method when the row is being databound but how do I find the control during the Page_Load event? Thanks for any help!!!   Penny  

Removing a (child) user control from an observable collection

Hey all, so I have an ObservableCollection of UserControls.  These user controls have their own xaml and each of these has some type of "Close" button so it would be removed from the ObservableCollection. A groupbox is binded to the ObservableCollection so it would show all the UserControls.  When a user clicks on the "Close" button, the user control is removed from the ObservableCollection and thus, the groupbox.  How can I do this?  I've tried something like   (this .Parent as ObservableCollection<asdf>).Remove(this );   where asdf is a UserControl but I get a bunch of compiler errors.

How can I register a name for a control that is an ItemsControl child?

Hello, How can I register a name for a control that is an ItemsControl child? When I create the controls dynamically in code, the RegisterName works just fine.  However, when those same controls are created by the ItemsControl XAML, RegisterName does not work. Here is the XAML which correctly generates what I want: <Canvas Name="Tab_CanvasTabs"> <Canvas.Resources> <local:CategoryTabs x:Key="myTabs" /> </Canvas.Resources> <ItemsControl Name="Tab_ItemsControl" ItemsSource="{Binding Source={StaticResource myTabs}}"> <ItemsControl.Template> <ControlTemplate TargetType="ItemsControl"> <ItemsPresenter /> </ControlTemplate> </ItemsControl.Template> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <Canvas /> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> <ItemsControl.ItemTemplate> <DataTemplate> <DataTemplate.Resources> </DataTemplate.Resources> <Canvas Name="Tab_Canvas_X" Tag="{Binding Path=Number}" MouseLeftButtonDown="Event_CategoryTab_Canvas_MouseLeftButtonDown" MouseLeftButtonUp="Event

How to Bind a child control with properties of the parent control in Silverlight and WPF?

Dear Experts, I have a usercontrol in Silverlight and I want to enable the update button inside the usercontrol with property defined in the usercontrol. For the proof of concept sake I have defined the usercontrol xaml and the code behind in VB.NETBelow is the XAML and VB.NET Code. ----------------------------------------------------------------------- <UserControl x:Class="SLBAppAssementQuestions.SilverlightControl1"     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"     xmlns:d="http://schemas.microsoft.com/expression/blend/2008"     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"     mc:Ignorable="d"     d:DesignHeight="300" d:DesignWidth="400">     <StackPanel>         <CheckBox x:Name="chkBox1" Margin="10" Checked="chkBox1_Checked" >Checkbox1</CheckBox>         <CheckBox x:Name="chkBox2" Margin="10" Checked="chkBox2_Checked">Checkbox1</CheckBox>         <Button  x:Name="BtnUpdate&q
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend