I've Creted Composite control which has FormView and two custom server control. The Control renders correctly. now when i add control to page from toolbox i want to edit Composite Control's FormView ItemTemplte as we edit ItemTemplate for generic formview (by clicking small arrow head).
any adeas?
When you create an instance of the FormView, programmatically add the templates to the FormView before adding it to the CompoisteControl in the CreateControlHierarchy() method.
Here is an extensive example
Related
Basically I have created a user control containing a Telerik RadGrid, inside the control I have another two controls that have Telerik RadGrid inside them. I am trying to bind the modified data back into the User Control inside the parent user control. I have checked that the data is correct after they have been edited but when the form is binded again the inner controls have the same data as the form is first loaded. I am using RadWindow. Coworkers have suggested that it works with asp.net form controls however it seems that there is an issue with Telerik controls. Is there a easy way to force a rebind of the control?
There is a Rebind() method you can call to enforce this. This method causes the refresh and reloads the data and calls NeedDataSource.
If I drag and drop a GridView and an ObjectDataSource onto a page, hook them up, pull in some data and let the controls handle everything automatically where is the code that tells the controls how to behave?
The server controls that you add to an aspx files are represetations of classes in the .NET framework that contain all the logic which is relevant to the controls behavior.
Since ASP.NET's CheckBoxList control does not allow itself to be validated with one of the standard validation controls (i.e., RequiredFieldValidator), I would like to create a UserControl that I can use in my project whenever I need a checkbox list that requires one or more boxes to be checked.
The standard CheckBoxList can be dragged onto a page, and then you can manually add <asp:ListItem> controls if you want. Is there any way I can create a UserControl that lets me manually (in the markup, not programmatically) insert ListItems from my page in a similar manner?
In other words, can I insert a UserControl onto a page, and then from the Designer view of the Page (i.e., not the designer view of the UserControl), can I manually add my ListItems like so:
<uc1:RequiredCheckBoxList>
<asp:ListItem Text="A" value="B"></asp:ListItem>
<asp:ListItem Text="X" value="Y"></asp:ListItem>
</uc1:RequiredCheckBoxList>
If a UserControl is not the appropriate choice for the end result I'm looking for, I'm open to other suggestions.
Please note that I am aware of the CustomValidator control (which is how I plan to validate within my UserControl). It's just a pain to write the same basic code each time I need one of these required checkbox lists, which is why I want to create a re-usable control.
An easier way to solve this problem is to use the standard CheckBoxList, but create a special server validator control specifically for the CheckBoxList. The following article shows you how to go about this - Creating Validator Controls for the CheckBox and CheckBoxList.
I had a Dropdrowlist and FormView to work hand in hand to edit/update data.
Now I need to add a radGrid and when a user clicks on the row, I need the FormView to be populated or I need my existing FormView to be populated inside the RadGrid's edit item template.
I'm binding a hashtable to a detailsview web control in ASP.NET 2.0. I have my edit/delete/insert link buttons on the detailsview, but when clicking new, the mode does not change.
Any ideas why?
I'm assuming that you have created a 'New' Button within the DetailsView. You should be able to simply handle the click event in your CodeBehind, and call the DetailsView.ChangeMode Method.
DetailsViewName.ChangeMode(DetailsViewMode.Insert)
DetailsViewName.DataBind()
In this case, I simply rebinded the DetailsView to show a blank form. You can also use the Click event to bind controls within the DetailsView form as well.
Fill out the form, click Add, and the Item_Inserting Event should get handled.