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
15
Not able to sort the Hyperlink column in Infragistics:ultrawebgrid
posted

Hi Team,

I am using Infragistics:ultrawebgrid in my project but i am facing an issue for sorting the hyperlink column. i have used below server side method for sorting  -

private void GD1_SortColumn(object sender, Infragistics.WebUI.UltraWebGrid.SortColumnEventArgs e)
{

if (e.ColumnNo != -1)
{
switch(GD1.Columns[e.ColumnNo].Key)
{

case "Name":
{
if(GridPager.Visible==false)
e.Cancel=true;

if (hidenFld1.Value=="true" || hidenFld1.Value==null || hidenFld1.Value==string.Empty)
{
//hidenFld1.Value="false";
}
else
{
//__submitHandler();
hidenFld1.Value="";
}
if(GD1.Columns.FromKey("Name").SortIndicator == Infragistics.WebUI.UltraWebGrid.SortIndicator.Ascending)
{
__sortColumn = "Name";
__sortDesc = "ASC";
}
else
{
__sortColumn = "Name";
__sortDesc = "DESC";
}

break;
}

default:
e.Cancel = true;
break;
}
}

//__pageNo = GridPager.CurrentPageIndex;
//__bindGridData();


if(GridPager.Visible==true)
__searchbyData(); -  This method is basically passing the parameter in SP and binding in the grid. I have checked the SP and it's working as expected(sorting is working fine while binding the grid) but the problem comes when we create the hyperlink column in GD1_InitializeRow server side method.

}

GD1_InitializeRow server side method -

private void GD1_InitializeRow(object sender, Infragistics.WebUI.UltraWebGrid.RowEventArgs e)
{
if (!(e.Row.Cells.FromKey("AgentName").Value.Equals(" ")))
{

e.Row.Cells.FromKey("Name").Text = "<A Href=\"javascript:AgentDetails('" + e.Row.Cells.FromKey("Id") + "','" + AcctID + "')\" class='GridAnchor'> " + e.Row.Cells.FromKey("AgentName").Text + "</a>";

}

}

As you see the above code. we are passing the two parameters one is id and another is account id. when it calls GD1_InitializeRow server side method then the control automatically sorts with agent id instead of Name. so the problem comes with  GD1_InitializeRow server side method.

Please suggest.

  • 20255
    Verified Answer
    Offline posted

    Hello Rishi,

    Thank you for contacting us. We no longer support the old controls, and my recommendation is to upgrade your app to a newer version of out controls. In order to gain better understanding of the upcoming work, we provide great Migration guide for the Grid, that can help you to perform smooth transition, as for the other components, there shouldn't be any issues with the migration.

    https://www.infragistics.com/help/aspnet/gridmigrationoverview

    As you will see from the provided reference, a lot of concrete explanation in relation to certain features are provided.

    In conclusion, you can have a look at our docs and online sample in order to gain better understanding what are the main differences between the old and new Aikido controls, and if some further and more concrete questions appear, you can contact us for any help.

    https://www.infragistics.com/samples/aspnet/

    https://www.infragistics.com/community/blogs/b/zdravko_kolev/posts/ultrawebgrid-to-webdatagrid-migration

    In general, we have great toolsets that will help you to achieve your needs, and if you want to check some other technology that will possible suits your needs, I am going to help you without hesitation.

    As for the issue that you are facing, both old and new grids are sorting/filtering based on Value and not Text. I am not sure what you are trying to achieve, although you should keep in mind that if you expect to sort based on the cell text, this cannot happen.

    I believe you will find the attached sample helpful.SortByText.zip

  • 15
    Offline posted in reply to Zdravko Kolev

    Hi ,

    I have tried with Value  as well but it's not working. The problem is not with sorting actually while binding the data with name column it's working fine. but the issue comes when the hyperlink column bind in - private void GD1_InitializeRow method

    e.Row.Cells.FromKey("Name").Text = "<A Href=\"javascript:AgentDetails('" + e.Row.Cells.FromKey("Id") + "','" + AcctID + "')\" class='GridAnchor'> " + e.Row.Cells.FromKey("AgentName").Text + "</a>";

    then the data sort with Id column which is passing as a parameter in anchor Tag that is not correct.

    Please suggest.