Custom Server Controls :: Dynamic Nested Control Not Persisting Data?
Sep 21, 2010
how to make a control that can have controls nested inside it. I've made a jQuery tab browser class which uses a hidden field to remember which tab is selected and create the relevant client script to re-select it on postback...it works fine...
This is for web part development so all controls are created dynamically.
The problem is when I add a control to one of the tabs, the values set in that control disappear on postback..I understand there is a lot of information about user controls, viewstate and control state but nothing seems to give me access to those values...
I've boiled it right down to the basics and still can't get it to work unless the custom control has all its controls added in OnInit...which is bad news for me because I need to instantiate the browser, the use a 'AddTab' method to add tabs and controls to them, which occurs after the OnInit event and therefore I can't access the postback values!!
I get the feeling I'm missing something big here, I must be lol...here's is an example:
[Code]....
These controls have to be dynamically created, so I didn't see the need to make the ascx user controls..
View 4 Replies
Similar Messages:
Oct 12, 2010
I need to create a reusable custom control,which is like a form containing a listbox and some fields.The fields can be either textbox or combobox as needed for different applications,which can be selected on the property of the form onwhich page that i am using it,also i needed to specify the number of fields in that property.And also need place 3 buttons below for edit and delete the selected item in the listbox and a button to save.Data will be binded from the database as needed for different applications.
tell me with code how to create it using asp.net server control in C#.
View 6 Replies
Jun 8, 2010
I am using two user controls in my page. The controls are loaded dynamically one at a time. I'm just referencing the user controls in the page and loading them dynamically using 'LoadControl()'. Everything is working fine till now and the user can switch the controls one another.
Here the issue I found is eventhough the controls are working as expected and the data is visible, the rendered HTML contains only the first loaded user control's markup.
Even if the current control displayed is 'usercontrol2', the source shows 'usercontrol1' markup. How can I force the page to render 'usercontrol2' markup and remove 'usercontrol1' markup while loading'usercontrol2'?
View 6 Replies
Sep 30, 2010
I have a datagrid that loads on page_load.
In this instance I can't load the datagrid in page_init as the results of the datagrid are determined by a checkbox and the checkbox would always be set to true during page_init to the viewstate not being loaded.
I have an OnItemDataBound event on the datagrid that dynamically creates controls and later on I want to access the value of some of these controls (e.g. a text box)
Of course the problem is I can't access these controls values as they don't persist over a postback.
View 1 Replies
Sep 13, 2010
have this piece of code which paint an ImageButton and show a dynamic ModalPopupExtender (with 2 buttons btnGuardar and btCancel).
The issue is neither btGuardar.Click nor btHidden.Click events are raised but ImageButton Click event is raised correctly.
[Code]....
View 4 Replies
Dec 26, 2010
I have built a custom control. when i add this custom control in my page twice or more then the it write only one time of its render contest data.
View 4 Replies
Jan 3, 2011
Hope this is the correct forum for this question. I am using VWD 2010 an have a web project and get the following error upon execution:
Parser Error Message: Unknown server tag 'custom:AjaxValidator'.
My code is as follows in the .cs file:
[Code]....
[Code]....
View 1 Replies
Aug 18, 2010
i've created a webform with one gridview having connected with the database using datasource. i.e password database with three colomn .
now want to insert the custom dropdown button using server control for each column.
when i select the dropdown list the list should display the value as required.
e.g if i click the uname dropdownlist then it should show the list of names.
if i click on pwd dropdownlist then it should show the list of numbers.
if i select any one of the value in the dropdown list then it should insert into the
database.
can i get code on this type of question...?
View 3 Replies
Jan 11, 2011
I have this problem - I'm working on an ASP.NET AJAX-application on a server without .net 3.5 which means I can't use ListView (BOO!).
I decided to simply do the ugly way of making a table and giving the tbody an ID and a runat server tag, and put HtmlControls inside from the codebehind (btw - this is a usercontrol, in case it makes a difference).
This all works fine - until the page does a partial postback - and all the elements disappear, since the tag is runat server I assume it requires to be repopulated in the page load.
Is there no way to actually persist the data on partial postback? And only have the content of the control change when I say so in the back end?
I guess I could save the content in a session object upon populating the control, and just repopulate in the Page_Load with the session object - but I was hoping there was a better way to do this?
View 2 Replies
Mar 4, 2010
I have a custom control which inherit from the Table class and in the constructor, it takes a an integer as an argument. There is no empty constructor.
Is there a way for the user to set that variable in the properties window after they drag the control onto a form.
I know some .NET controls, you can set the source for the parameter to different things like another control's property, QueryString using just the properties window.
Right now, I have to create the control dynamically. I read the query string and then created the object.
View 1 Replies
Aug 4, 2010
how do i get the values of the textboxes of my dynamicly created user controls. I have somthing similar to the code below which adds many instance of the same user control to a panel but with diffrent properties value :
[Code]....
and here is the code-behind for the control
[Code]....
and this is the .ascx
[Code]....
And here is what the controls look like when thay are created
[URL]
I know that i have to recreate the controls on each postback but i need to know how to get the values of the entered text for each textbox
View 9 Replies
Jan 6, 2010
I have a scenario where I've created a custom control that connects to a database and gets records from the last X number of months where X is any desired number. I use a "MinDate" parameter to determine how far back to look.
When I add my control to my page, how can I set the "MinDate" parameter to something like "DateTime.Today.AddMonths(-3)"? I've tried:
MinDate="<%= DateTime.Today.AddMonths(-3) %>"
View 4 Replies
Dec 24, 2010
here's a situation and I would appreciate your response.
I have programmatically created the Wizard control:
Page_Load(obj s, evargs e)
{
Wizard ClaimDetailWizard = new Wizard();
foreach(int item in selectedItems)
{
//create new step
//added custom control to new step
//add step to wizard
}
//added wizard to a placeholder on a page
}
Based on List I get from Session i added new steps to my wizard To each step I had added a custom control
Each custom control in tern contains another custom Gridview Control in it.
So here's the problem when the page loads for example for two steps. All is good Wizard does what it's supposed to do.
But when I try to use sorting or paging in that custom Gridview. Somehow it displays the gridview I should see in the next step of the wizard.
Also what I'm noticing through debugging. Is that when I press next in the wizard I go back to the original page where I do all of the code specified above, and it recreates the wizzard. But it goes to the next step. Is this the way wizard supposed to work? Just doesn't seem very efficient.
View 1 Replies
Aug 20, 2010
i am new to technology so go easy on this post according to what i read from web there are 3 type of custom server controls 1 superclass2 composite 3 renderedi found video tutorial for superclass custom server control but couldnt find video tutials for other 2.lease forward me link for composite and rendered custom server controls video tutorial
View 1 Replies
Dec 20, 2010
created a Custom Textbox Control that is intended to be a "masked date" textbox, so that I can handle different ways a user might enter in a date and make it work no matter what.I did this by creating a custom control with 3 separate Textboxes one for month,one for day one for year,then do some handling for different things that could be entered and it would all work.
The problem I am having is,when I add this control to the page,if I do an alert to check the Text value of the custom control it just gives me "[ServerControl1]" even if I enter in a date.
I tried doing an AutoPostback after entering so that it would refesh the Viewstate to have the values of the textboxes but the control doesnt seem to actually postback, even though I have it enabled.accessing the Textbox value after someoen
has entered a date?first custom control I have created and have been using google.
My Server Control Code is as follows:
[Code]...
View 1 Replies
May 17, 2010
I am creating custom server control. I have two classes in project. One is main class that render control and another will be used to render content based on condition.I just want to know how to render content from other classes in main class.For example. This isjust an example.My main class code
[Code]....
My TopLeftPane class
[Code]....
My page code on page load event
[Code]....
When I run the page, Header title always getting null. This is a just sample code. I will have more than 20 classes so I dont want to write a code in main class to render whole control.I hope all of you understand my problem.
View 3 Replies
Jul 28, 2010
Case : a templatefield Text Box created by class TemplateHandler and added to the composite
control Grid .how to bind it to the DataSource Object of the Grid Class ?
View 2 Replies
Oct 22, 2010
I have to use inline code for an aspx page and I need to use a custom server control that is defined in the same aspx page but the control does not get processed as a server control. it gets returned as is as static html tag.
View 3 Replies
Mar 22, 2011
I am trying to build a custom composite control, which allows me to add custom content to each child control. It's a similar concept to what you have with a GridView and TemplateColumn. The markup used to place the control on the page would end up being something like this:
[Code]....
I have the code below, which allows me to put that markup on the page without throwing any errors, and it renders all the correct HTML, except it doesn't render the contents of the ColumnTemplate. I have replaced the Render() code with a comment because it's quite long winded and doesn't add anything important here:
[Code]....
I have tried to follow examples on MSDN and other forums but I can't make this work. I think I'm missing the code to render the contents of the template, but I don't know how to hook that up.
View 1 Replies
Jul 22, 2010
I need to develop control (template or user) which must have subtags with some items.
For example :
<SomeControl runat="server" id="scTest">
<column1>TestColumn1</column1>
<column1>TestColumn1</column1>
<column1>TestColumn1</column1>
</SomeControl>
This control may contain some other web server controls such as GridView.I need explanation of experienced developers, how to do that - take me to the right way
View 3 Replies
Apr 4, 2010
I have a custom server control inheriting from CompositeControl. It consists of two RadioButtonlist controls that are rendered side by side in an html table. The number of ListItems in each RadioButtonList is not known until runtime. Depending on how many items each list contains, the RepeatColumns property of each list is set differently. To do this in the handler for the ItemDataBound event I need to get the count of ListItems in each RadioButtonList. How do I expose the Items.Count property of each internal RadioButtonList as a top-level property? I tried using a getter to return the count but this generates a compile-time error to the effect that the count cannot be assigned to--even though I have not created a setter.
Similarly, in the handler for the Submit event, I need to get the ClientID of each internal RadioButtonList to pass to a method that checks for data changes. How do I expose the ClientID of each component RadioButtonList as a top-level property?
I can of course index the Controls collection of the composite control to access the child control and read its properties--but that defeats the whole point of making a complex, independent custom server control.
View 1 Replies
Oct 27, 2010
I have created a user control and am ready to convert it into a custom control. I am trying to follow:
[URL] the steps mentioned in the link.
I am not seeing Build / Publish Web Site option.
I am using VS 2008. I only see Publish User Control but it doesn't give all the settings mentioned below. When I do publish user control, it just copies the ascx file to the desired location. how can I convert the user control to custom control.
View 2 Replies
Sep 13, 2010
How would I add a (dropdown) list of available values for a custom server control property?
(Just like 'Visible' property of most controls has valid values of 'True/False' and nothing else can be entered or selected)
View 3 Replies
Oct 19, 2010
I am creating a custom server control, and I am wanting to include a JavaScript file in the dll file when the control is built. I have tried suggestions from the following websites:[URL] But after following the directions, If I use firebug to see what errors show up, the JavaScript functions that are being called all say "goNext is not defined" which leads me to believe the JavaScript file is not being added correctly.
Some information on what my control looks like
I have the JavaScript File in a folder called Script. The namespace of the project is CustomControl, and the Name of the project is MaskedDateTextbox.
In my AssemblyInfo I have the following:
<Assembly: AssemblyVersion("1.0.*")>
View 24 Replies
Oct 4, 2010
is it posible to add client side functionality to a custom server control in vb.net?i am looking at msdn library and there is no code for vb :/ http://msdn.microsoft.com/en-us/library/aa719700%28v=VS.71%29.aspxI fount this on MSDN Library Adding Client Capabilities to a Web Server ControlWhat i'm trying to do is to add some client functionality to my control, so that you can get or set some properties/values on client side. From the above link i see that this is doable with Ajax Server Control, but i don't have it, i have Custom Server Control. Can i do this with Custom Server Control and how?
View 16 Replies