Hi,
I need to handle the server side double click event for webdatagrid. Does any one know how to do this?
ThanksSameem
Hello vineetg80,
I know it`s been a while since you posted in the community but if you are still in need of assistance I would be glad to help.
What I can suggest for achieving your requirement is to check in your DoubleClick client side event whether the event was fired from clicking the grid cell or header. If the DoubleClick is raised from a grid cell than store the row index and column index of this particular cell in 2 varaiables. In order to send this variables on the server side a postback is needed. To raise a postback __doPostBack function is called and we are using it`s EVENTARGUMENT to pass the value to the server side. Since in this scenario two values have to be passed they could be passed as JSON string and afterwards parsed on the server. For example:
function WebDataGrid1_Grid_DoubleClick(sender, eventArgs){ if (eventArgs.get_type() == "cell") { var rowIndex = eventArgs.get_item().get_row().get_index(); var columnIndex = eventArgs.get_item().get_column().get_index(); __doPostBack('WebDataGrid1', JSON.stringify({ 'rowIndex': rowIndex, 'columnIndex': columnIndex })); }} //server side protected void Page_Load(object sender, EventArgs e) { this.WebDataGrid1.DataSource = MakeTable(); this.WebDataGrid1.DataBind(); if (IsPostBack) { GetColumAndRow deserializedArgs = JsonConvert.DeserializeObject<GetColumAndRow>(Request["__EVENTARGUMENT"]); var columIndex = deserializedArgs.columnIndex; var rowIndex = deserializedArgs.rowIndex; } } public class GetColumAndRow { public string rowIndex { get; set; } public string columnIndex { get; set; } } }
function WebDataGrid1_Grid_DoubleClick(sender, eventArgs){
if (eventArgs.get_type() == "cell") {
var rowIndex = eventArgs.get_item().get_row().get_index(); var columnIndex = eventArgs.get_item().get_column().get_index();
__doPostBack('WebDataGrid1', JSON.stringify({ 'rowIndex': rowIndex, 'columnIndex': columnIndex }));
}}
//server side
protected void Page_Load(object sender, EventArgs e) { this.WebDataGrid1.DataSource = MakeTable(); this.WebDataGrid1.DataBind();
if (IsPostBack) {
GetColumAndRow deserializedArgs = JsonConvert.DeserializeObject<GetColumAndRow>(Request["__EVENTARGUMENT"]);
var columIndex = deserializedArgs.columnIndex; var rowIndex = deserializedArgs.rowIndex; }
} public class GetColumAndRow { public string rowIndex { get; set; } public string columnIndex { get; set; } }
}
I also made a small sample project illustrating my suggestion and I am attaching it for your reference. For my test I am using version 12.2.20122.2075 of NetAdvantage.
I hope you find this information helpful. Please feel free to contact me if you have any additional questions regarding this matter.
Can you pls upload a sample code for how to handle double click of a cell at client side in webdatagrid and then how to call the server side function in that call.
I m trying to retrive the row and column of a cell which user has double clicked. But args.get_type() is returning null.
Below is the code i have written.
We are using unbound columns in the web data grid ( netAdvantage 2011.1)
.aspx page code :
="False"
="dgMainPlanInitializeRow"
>
="true"/>
/>
="Multiple">
="onRowSelectionChanged"/>
="False">
Javascript code()
// function to handle double click on cell
function
MyFunc(sender, args) {
if (args.get_type() == "cell") {
var irow = args.get_item().get_row().get_index();
var icol = args.get_item().get_col().get_index();
alert(
"row:" + irow + " col:" + icol);
In this function MyFunc, when i m checking
if (args.get_type() == "cell")
I found thta args.get_type() is returning null.
Pls help in resolving this issue. An early reply will be highly appareciated.
I am a beginner to web dev. Can you please post the sample code explaing the above process. I have added a webdatagrid 11.1 into my webpage and would like to capture the selected row when a double click is made on the particular row.
<
ig:WebDataGrid ID="WebDataGrid1" runat="server" Height="350px" Width="400px"
ViewStateMode="Enabled" EnableAjax="False" ClientEvents-DoubleClick
="webDataGrid_DblClick">
Thanks in advance
What should I do next? Please help
i have same problem, can you give me example how to catch the event in client side and invoke function in server side?
Can you please post a sample for postback from client side to server? Moreover, client side has double click on the rowselected.