Is there an event when I click the X button?
There is not such event, but it is possible to handle a related event, instead. The solution is descrived in DevExpress knowledge base: Which event is fired when the [x] button in the filter panel is clicked?
Related
I can handle the PreviewKeyDown event when some items of a DataGrid are selected.
But if users don't select any items, the event will not be triggered.
Could I handle the PreviewKeyDown event in this case?
You can handle previewkeydown on the datagrid but something in the datagrid would need to have keyboard focus.
Technically, that can happen without selecting a row.
Even then, you might find a control in the datagrid handles the event.
Is there a way to send message (like mousedown) to a control?
My purpose is that when you click GridView, prevent mousedown behavior itself and bypass mousedown message to RepositoryItem.
From your question: "My purpose is that when you click GridView, prevent mousedown behavior itself and bypass mousedown message to RepositoryItem."
It sounds like you want to control the behavior of the Mouse Down event on the control. Right?
If that's the case, on the Winforms designer, look at the properties panel. On there is also a selection for the form events for a control. You can scroll down and find the Mouse Down event and add an event handler. Then do whatever filtering you need including not even processing the message at all.
You also mentioned that it's a DevExpress control. I recall that some of their controls were wired up a little differently so the DevExpress website might have some additional clues.
I am using C#, ASP.net 3.5
How to capture the row change event of repeater in javascript?
There is no such event exists in Repeater control. Take a look at MSDN article.
You should bind to the change event of items in your row in javascript. The default on_change event of .net does a postback, so you can handle it server side. You can also capture the mouse hover event on the row in javascript and handle the mouseenter en mouseleave methods to update your data or something. See: how to handle row change event of table using jquery?
I am using Telerik RadGrid, i add a new button in the grid but how can i write an event for this button (Buy) for example when the user press (Buy) it will add this item to his cart with its price in order to calculate his bill.
regards
You need to listen for the ItemCommand event:
<telerik:GridButtonColumn UniqueName="Buy" ButtonType="LinkButton"
Text="Buy" ConfirmText="Add to cart?"
OnItemCommand="rg_ItemCommand" CommandName="AddToBasket" />
In your codebehind
protected void rg_ItemCommand(object sender, GridCommandEventArgs e)
{
if(e.CommandName == "AddToBasket")
{
// Add to basket code here
}
}
You may also need to set the CommandArgument during the ItemCreated or ItemDatabound events, or get it using something like rg.MasterTableView.DataKeyValues[e.Item.Index]["ItemId"].ToString(); after setting ClientDataKeyNames="ItemId" in your MasterTableView settings part in the ascx file (if it is databound).
You need to use the ItemCommandEvent of grid. The ItemCommand event is raised when a button is clicked in the Telerik RadGrid control. This allows you to provide an event-handling method that performs a custom routine whenever this event occurs. Follow the LINK to have more details.
When you create the button you'll want to add an OnClick event to it to handle the click on the button. In this event you'll then add the item to the cart. You'll need to parse the parent row of the button to know which item it is.
Edit:
Since you are using a GridButtonColumn and not adding a button as you stated then this applies instead (from Telerik.com):
This column renderes a button of the
specified ButtonType in each
corresponding cell of the items of
type GridDataItem and
GridEditFormItem. You can use this
buttons to fire command events that
can be handeled in RadGrid.ItemCommand
event handler. This, in combination
with the event bubbling mechanism in
Telerik RadGrid, allows you to create
a column of custom button controls,
such as Add, Remove, Select or Edit
buttons.
So essentially you'll need to use the grids ItemCommand event to handle the button click.
i'm doing a webshop in asp.net (c#).
Is there a way to push the edit button in the gridview through the code of c#?
I have a "new" button, that just adds the row, it would be great if that same row would "open" itself for editing without user having to press "new" then "edit"...
I know there are other ways to do this, i just want to know if this is possible... it would save tons of time!!
thanks in advance for the anwsers!!
Andrej
Just call the event handler you wrote to handle the edit button push.
Basically speaking, all that happens in code when you click a button is that the button's Clicked event is raised. In a GridView, the event is actually something like GridViewButtonClick. However many handlers you have plugged in will then execute (and you can't, and shouldn't have to, control the order of execution). For a built-in button, because you cannot raise the event from outside that button, you can simulate the button click by just calling the handlers you have attached to the event. If this were your own custom control, you could define a method you could call from outside that would cause the control to raise a certain event.