Telerik Grid , Telerik Window and Confirm delete action - telerik-mvc

I have a Telerik Ajax bound grid containing a Html.ActionLink for deleting a record. On clicking this link, a Telerik Window opens which is contained within a Html.BeginForm tag.
In this form, there is a telerik Window having 2 buttons "Yes" and "No" for confirmation. This thing works pretty much fine but only problem is that when I delete a record, the entire page is refreshed which is not required.
I am thinking about converting Html.ActionLink to Ajax.ActionLink and Html.BeginForm to Ajax.BeginForm.
How can I Ajax-enable my Html.ActionLink and Html.BeginForm?

You should use the built in grid features. In the databinding section, declare your delete action
.DataBinding(dataBinding => dataBinding.Ajax()
.Select("_AjaxBinding","ControllerName")
.Delete("_AjaxDelete", "ControllerName")
)
Then add a command button to the columns array
columns.Command( o => o.Delete().ButtonType( GridButtonType.Text ) );
and that's it. Your delete action will delete the record (takes an int id parameter) and then return return _AjaxBinding(); at then end of the action.

Related

Combobox List passing string

I have a VB6 application that has been running for quite sometime. Currently I'm trying to update one of the form that has a combobox 2.0. Because the combobox is populated with hundreds of items - I'm trying to update it so that users are able to click on a look up button next to it, where another window opens up with all the items from the combobox. User will be able to search by keyword and/or select an item and double click on it and have it appear in the combobox. The issue I'm having is with trying to pass no value or "" when CANCEL is clicked. I'm able to pass the value if I in the properties window my STYLE Is set to COMBO rather than list. However, the issue I come across is that with COMBO the value (text) in the combobox sometimes is not aligned properly. Is there a way to pass a "" value to a combobox 2.0 without changing the style to COMBO?
If they hit cancel set the ListIndex of your combo to -1 rather than setting the text property. This is the value for no item being selected.

Simulate a click event on a grid row

How can I dynamically click rows in my grid?
E.g.: I am using border layout.
I have a grid in the west with a list of Companies.
When I click on a Company, the information of the company which has an Id, is displayed in a form in my center area.
Now, when I want to add a company ( I am doing this with a button which opens a "Add window"), and type all information in the form and then press "save", I reload the grid.
How could I make it, that the company which is newly added, is clicked on and its information is displayed in the center area.
NOTE: The companies are listed with an ajax request, and the information is called with a "onCompanyGridHandler".
You can make the new campany created added in the top of the grid by sorting the grid's store with, for example, the date of campany creation. You can so add this line in the grid's store:
sorters: { property: 'datecreate', direction : 'DESC' },
Then, after the campany creation, you select the first row of the grid, using this code:
Ext.getCmp('your_grid_id').getView().select(0);
There are a couple of approaches you can take here:
In the function where you add the data from the Add Window to the grid panel's store, you can also get the form and use the form's loadData() method to load the data into the form, populating both the Grid and Form at the same time.
As is mentioned in a comment, after adding the data to the grid's
store, make fire the click event on the row in the grid that is
displaying the new data. I prefer the first approach because you do
not have to find the correct row in the grid and fire its click
event. In the first approach both the grid and form are loaded
with the data directly.
David

On Click on the RowHeader the current row should be editable and On click of the columnHearder current column of all row should be editable

I have a silverlight DataGrid, by default on page load the all the cells of the datagrid should be Readonly. I have 2 problem , can any one help me?
1.On Click on the RowHeader the current row should be editable
2. On click of the columnHearder current column of all row should be editable
This might not solve your entire problem but it should partially address it.
This is to make a column read-only in a datagrid
DataGrid.Columns[7].IsReadOnly = true;
Obviously the property can be changed from events but the data grid does not have row/column headers event handlers. Custom controls seem the way to go without introducing any new gui elements like buttons and changing the feel of the application.

Datagrid Command Binding to buttom, don't select row

I have a command bound to a button on my datagrid (e.g. button shows for everyrow).
Basically the command is wired to an object which shows children of that row in a pop up window.
Problem is the customers wants it to display the chid data but not actually select that row in the datagrid.
you have some options:
you can use a style
you can the UnSelectAll() method
and if you google you will find some more
EDIT:
did you try to handle the PrevievMouseDown Event? you can set e.Handled=true if the user click on the button.

Cannot seem to fire DeleteCommand when button is an datagrid. Selected event always fires

I have a Wpf Form with a tabControl with 2 tabs "Customers" and CustomerDetail"
First Tab is a list of all Customers populated in a datagrid and delete Button as a dataTemplate on each line of the grid.
Selecting a customer it gets the customer details and moves to the second tab.
This all in MVVM and the delete button is mapped to a DeleteCommand .All good.
My Problem
It cannot seem to distinguish when clicking on the delete button it fires the selected event and goes to the other tab.I dont want it to go to the other tab when pressing delete.
How can I do it?
User selects row and should go to the other tab.
Row is selected and presses delete button just trigger the delete command.
Hope all clear
Any suggestions?
Try using DoubleClick event for showing CustomerDetails tab. so, when user click on delete button, they just fire click command of the datagrid and nothing happen...

Resources