Hello,
I need to make an entire row be a link. How can I do this in iggrid?
Thanks.
You mean this?:
@(Html.Infragistics().Grid<DocumentsGridViewModel>().ID("thisGrid")
.Columns(column =>
{
column.For(x => x.DocumentId).DataType("int").HeaderText("Doc Id").Width("70px").Template("<a href='?IDNumber=${DocumentId}&documentType=${DocumentType}&companyId=${CoId}> ${DocumentId} </a>");
column.For(x => x.CompanyId).DataType("int").HeaderText("Partner").Width("130px");
column.For(x => x.DocumentType).DataType("string").HeaderText("Doc Type");
column.For(x => x.Date).DataType("int").DataType("date").Format("MM/dd/yyyy hh:mm:ss tt").HeaderText("Date").Width("100px");
column.For(x => x.StatusDescription).DataType("string").HeaderText("Status").Width("100px");
column.For(x => x.Key).DataType("string").HeaderText("Key").Hidden(true);
})
.Features(feature =>
feature.Paging().PageSize(10);
feature.Resizing().AllowDoubleClickToResize(true).DeferredResizing(false);
feature.Sorting().Mode(SortingMode.Single).ColumnSettings(settings => settings.ColumnSetting().ColumnKey("DocumentId").AllowSorting(true));
.Width("100%")
.Height("320px;")
.DataSourceUrl(Url.Action("GetDocumentList", new {searchProcessed = ViewBag.SearchProcessed, query = ViewBag.Query}))
.ClientDataSourceType(ClientDataSourceType.JSON)
.DataBind()
.Render()
)
Hi Jessica,
Can you provide sample code with grid chaninig configuration?
Best regards,
Martin Pavlov
Infragistics, Inc.
It is enclosed i scrip tags. And it compiles just fine. At run time though, when I click on the row, it gives me that error. I think it cannot find the datarecord that I was referring to.
dataRecord is a JavaScript variable so it should not have anything to do with C# compilation.
You should check if the button click code is enclosed in html SCRIPT tag so it doesn't interfere with C# code.
Hope this helps,
Clicking the entire row works. But I can't get the parameters to work.
$("#thisGrid").find("tr").live("click", function (event) {
// use primary key (data-id attribute), to lookup the data record from the data source, or some other info, in order to navigate to a URL
var rowId = $(event.currentTarget).attr("data-id");
var dataRecord = $("#thisGrid").data("grid").dataSource.findRecordByKey(parseInt(rowId));
window.location.href ="http://google.com?g=" + dataRecord.DocumentId;
});
But it gives me a compilation error "CS0103: The name 'dataRecord' does not exist in the current context "
Also, I'm using razor. Maybe I'm just missing something
{...