Portal Engine Questions on portal engine and web parts.
Version 7.x > Portal Engine > UniGrid Action CommandArgument View modes: 
User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 4/9/2013 2:31:14 PM
   
UniGrid Action CommandArgument
I need to set the CommandArgument to a comma seperated value. I've attempted
CommandArgument='<%# Convert.ToString(Eval("Column1")) + "," + Convert.ToString(Eval("Column2")) %>'
and get a notice that you cannot bind to this control. I've attempted in the OnExternalDataBound event and can debug and see the actual CommandArgument is being set but it always returns the first column
case "setcommandargument":                
object param = null;
if (parameter is System.Web.UI.WebControls.GridViewRow)
{
param = ((System.Web.UI.WebControls.GridViewRow)parameter).DataItem;
}
else if (parameter is System.Data.DataRowView)
{
param = parameter;
}

int acctCode = ValidationHelper.GetInteger(((System.Data.DataRowView)param).Row["RS_ACCTCODE"], 0);
int confirmNumber = ValidationHelper.GetInteger(((System.Data.DataRowView)(param)).Row["RS_CONFIRM"], 0);

ImageButton btn = ((ImageButton)sender);
btn.CommandArgument = acctCode.ToString() + "|" + confirmNumber.ToString();
return btn;
and failed, it looks like it always returns the first column of the dataset. How else can I use this and pass in a composite primary key?

I've also discovered since I have this control in a jquery dialog (control is shown with click of link) the OnAction event isn't fired after the dialog is opened, why?

User avatar
Certified Developer 8
Certified Developer 8
Petr Dvorak - 4/9/2013 3:53:31 PM
   
RE:UniGrid Action CommandArgument
FroggEye wrote: I've also discovered since I have this control in a jquery dialog (control is shown with click of link) the OnAction event isn't fired after the dialog is opened, why?
I am not sure but I think jQuery dialog clones the DOM branch and copies it to the end of <body> element outside the <form> tag. Therefore postbacks are not available.

Possible solution: add custom JS action to the button in the dialog and after clicking the button move it back inside the <form> and submit again manually.

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 4/9/2013 4:24:01 PM
   
RE:UniGrid Action CommandArgument
Thanks Petr. Unfortunately, you've talked way over my understanding of jQuery. Also, I'm using the built-in UniGrid and action buttons, how can I implement your possible solution? Not sure where I'd perform this action.

User avatar
Certified Developer 8
Certified Developer 8
Petr Dvorak - 4/10/2013 6:32:26 AM
   
RE:UniGrid Action CommandArgument
Unfortunately I dont have a general solution and it depends on your situation.

However something like this could do the trick for jQuery UI dialog:
$('.ui-dialog-content input[type="image"]').live('click', function() {
if ($(this).parents('form').length) {
// inside <form> element, no problem
return;
}

// outside <form> element, necessary to move it inside the form

$('.ui-dialog').appendTo($('form:eq(0)'));

// submit again with a short delay
var el = $(this);
setTimeout(function() {
/* delayed submit */
el.trigger('click');
}, 100);

return false;
});
You need to check if the UniGrid uses <input type="image"> or "submit" and change the selector appropriately.