Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
975
getting the value of a hidden column - igGrid
posted

In my grid I have multiple rows, each row has a 'view' button on it.  I want to be able to click a button in a row and use the value from an underlying hidden column to open a new page and display data associated with that value (its a primary key).  How do I get the value for the hidden column from the row I click the button in ?

heres my grid

@(Html.Infragistics()
.Grid(Model)
.ID("contractGrid")
.Width("100%")
.Height("275px")
.PrimaryKey("ID")
.AutoGenerateColumns(false)
.AutoGenerateLayouts(false)
.Columns(column =>
{
column.For(x => x.ContractId).HeaderText("").Width("5%");
column.For(x => x.ContractCommodity).HeaderText("Commodity").Width("15%");
column.For(x => x.ContractRef).HeaderText("Ref").Width("10%");
column.For(x => x.ContractDate).HeaderText("Date").Width("15%").DataType("date").Format("dd/MM/yyyy");
column.For(x => x.ContractStartDate).HeaderText("Start").Width("15%").DataType("date").Format("dd/MM/yyyy");
column.For(x => x.ContractEndDate).HeaderText("End").Width("15%").DataType("date").Format("dd/MM/yyyy");
column.For(x => x.ContractBuySell).HeaderText("Buy/Sell").Width("20%");
column.Unbound("View").Width("5%").Template("<input type='button' onclick='viewContract(${ContractId})' value='View' class='btn btn-primary btn-xs' />").HeaderText("").Width("5%");
})
.Features(features =>
{
//features.Sorting().Type(OpType.Remote);
features.Paging().PageSize(10).Type(OpType.Remote).RecordCountKey("TotalRecordsCount");
features.Hiding().ColumnSettings(settings => settings.ColumnSetting().ColumnKey("ContractId").Hidden(true));
//features.Filtering().Type(OpType.Remote);
})
.ResponseDataKey("Records")
.DataSourceUrl(Url.Action("GridGetData","Contract"))
.DataBind()
.Render())

I then have some javascript in the page to acyivate the specified controller action

<script>

function viewContract(ContractId) {
window.location.href = '@Url.Action("Details", "Contract")?id=' + ContractId;

}
</script>

can you give me some example code ?

Parents Reply Children
No Data