I want to load different controls like DROPDOWN,RADIO in single column in Telerik Rad Grid's edit mode.
Means in every row, i want to pass some value from database like
id | control|
1 | dropdown
2 | radio
3 | checkbox
now when i pass 1 in column , telerik grid should load dropdownbox in edit mode.
in another row if i pass 2 than in same column but in that perticular row it should load radio button in edit mode.
Is it possible to do?
you have to set AutoGenerateColumns="False" and then create your custom "RadGridTemplateColumn"'s in your ascx-file.
In each TemplateColumn you can define "HeaderTemplate", "ItemTemplate", "EditTemplate". The EditTemplate will be shown if you are in edit mode.
In this you can show your controls.
Iam not sure what you exactly mean but I think you wanna show a dropdownlist in the Row 0 of your grid and in the next item (Row 1) you wanna show at the same position a radiobuttonlist right?
You can achive this by using the Event "OnItemDataBound".
if (e.Item is GridEditFormItem && e.Item.IsInEditMode)
{
}
use this to be sure that you are in the editmode.
There you can for example hide some controls or maybe create them dynamically and add them to the page.
If you wanna create new controls dynamically I would suggest you to place a asp:PlaceHolder at the specific position in your ascx-file.
hope I understood you right.
best regards, noone.
Related
I have a grid with ASPxCheckBox in Data Item Template. How to get KeyFieldValue of all rows whose checkbox is checked. I am trying to do this using client-side code and do it for whole grid not on visible index. Is it possible?
Note: I cannot use simple row selection command column as I am using it for some other purpose.
if you dontuse client-side code, you should use detailrow in aspxgridview. And you must use beforeperformdataselect event. if you really need checkbox, you can add checkbox a new field in asapxgridview.
I want to add a addtional value "ALL" into devExpress grid pager dropdown.Default display following setting
<PageSizeItemSettings Items="10,20,50,100" Visible="True">
</PageSizeItemSettings>
I want to add one addition value All into PageSizeItemSettings dropdown.When i clicked on All it should display all the table row. How can i do this?
I got the solution related display All option in pager.
I want to hide a row with contols of a grid view at runtime but controls should be enabled.
I have a grid view which consists a checkbox, 2 textboxes and 1 dropdown list control for every row and i want that on a particular condition that grid view row should not be displayed but internally these controls should be enabled.
Set the row's css style to display: none.
See here: Selectively apply css to a row in a gridview
I have an ASP .net grid view. It has some template columns like a command button, a text box, and a dropdown control. When I click the command button, a new row needs to be inserted below the current row (from where I hit the command button).
If I have rows 1 and 2 and I hit the command button in row1 a new row needs to be inserted between rows 1 and 2
Now in the new row I should be able to select values from dropdown and enter some value in a text box and finally hit my save button. (Which should work fine as I am expecting)
The grid view is bound to some data source say for instance a datatable for now.
Oneway that I could think about is when Command button is clicked, I can add a new row to the datatable in my server side code and rebind the grid. But I am not sure that, from a UI perspective how I can make sure that the new row goes exactly below the row from where I hit the command button.
Any thoughts or comments?
I think a much easier approach will be if you try to add the row in your data source and then bind to the GridView again. This is easy if you have DataSet or a custom entity collection. Since, you are using DataTable this will also work. Handle the click event and find the row that the user clicked. Go back to the dataTable and add an empty row there. This will make sure that the controls inside the GridView are persisted and you don't have to worry about adding DropDown controls etc.
You have to sort the datasource by an virtual index saved in an invisible column. On first databound(perhaps you take a DataView because of ots sorting capability) it will set to the original rowindex. After first hit of the save button you get the datatable again from database and add the additional row with an index after the "selected" row. Then you bind the GridView again with the sorted DataView.
I think you need another invisible column to detect the "temporary" row. If you dont need to edit the "normal" rows then you can use edititemtemplate for this. Otherwise you can make the dropdown and textbox visible and the other controls invisible in GridView.OnRoawDataBound.
There is a code sample that is used for adding a new row in between rows in a grid view.
1) Have a listbox with 3 values out of 5 selected
2) When I click to select another value without holding CTRL button, it will unselect over values
How to make it keep other selected values if new value is selected?
This is going to sound like a snide answer, but I don't mean it that way. I just like to look for the simple solutions rather than the complicated onces.
The easiest way to get a control to have the behavior you want is to use a control that has the behavior that you want, rather than modifying the behavior of an existing control.
That said, if you want a list of items where a user can select a bunch of items off the list, and don't want to have to rely on them holding control, you're using the wrong tool for the job.
Use a CheckBoxList instead of a ListBox. If you want it to be scrollable, then set it in a div of a specific height, and set the style of the div to "overflow: scroll".
If you still want to use a ListBox you should use javascript and for each click event fired, you should check if the clicked element is selected/unselected and act accordingly. It's a little bit tricky but at least it is a solution for your problem.