Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
134 views
I am trying to use a rad listview contol to display data from a SQL data table.  When the data is loading (binding) I need to examine the data columns and perform some modifications to the data and replace the value in one of the data fields with the modified data.  For example, there are three fields of data in the underlying query.  Field 'A' contains 'abc'.  Field 'B' contains '123'. Field 'C' contains an empty string.  I want to concatenate the contents of Fields 'A' and 'B' and the place the results 'abc123' in Field 'C' which is defined in the listview layout.

I do these (and other) sorts of modifications to data regularly when using the rad grid.  Can I do them when using your listview control as well?

When performing these operations in the grid, I use the "ItemDataBound" event and perform a test at the beginning of the event for "If TypeOf e.Item Is GridDataItem Then.....Else....End If" such as:

Protected Sub RadGrid1_ItemDataBound(ByVal sender As Object, ByVal e As GridItemEventArgs) Handles RadGrid1.ItemDataBound
    If TypeOf e.Item Is GridDataItem Then
            sLat = ""
            sLong = ""
            Dim item As GridDataItem = DirectCast(e.Item, GridDataItem)
        item("TextActive").Text = "Yes"
    End If
End Sub


I have tried doing something similar in the same event for the RadListView control, but always get errors -- you may refer to the attached screen capture.

Is there a way to modify the data to appear in the radlistview similarly to what I am doing with the radgrid?

Thanks in advance!

Lynn
Veli
Telerik team
 answered on 24 Jun 2011
3 answers
66 views
I have assigned multiple Group FilterExpressions to my ListView and am receiving the following error on postback:

"Index was out of range. Must be non-negative and less than the size of the collection."

Wondering if this indeed a bug or if I'm databinding my Listview incorrectly?  I'm using the NeedDataSource function of the ListView to load the data.  I have a button to "Apply Filter" that calls the RadListView1.Rebind method.  I've tried to trace but the error is thrown before any databinding occurs on the Listview (something to do with the Viewstate for the FilterExpressions on the ListView)?

Thanks for any help,
Jason
Veli
Telerik team
 answered on 24 Jun 2011
2 answers
54 views
Hi guys,

Does anyone know how to modify the Calendar Special Days from the JavaScript?
So it's like initially the special days contains 1 Day set to today, and then  I'd like to change it to tomorrow or any other date.

Thank you,
Best Regards,
Ronald Wisnu Hariyanto
Ronald
Top achievements
Rank 1
 answered on 24 Jun 2011
1 answer
92 views
Hi,
I try to export radgrid to excel file. In xls file, the header text of column name is center aligned. I want to have them left aligned. How to do it? Thanks.
Princy
Top achievements
Rank 2
 answered on 24 Jun 2011
9 answers
217 views
Hi,
                 I need some help guys . I need  a treeview to be inside a combobox that i know how to do .
But what i need i also need to filter the comboBox. Atleast  i need to filter the Parent Elements.
Help me guys .
Sankar
Karthik Kantharaj
Top achievements
Rank 1
 answered on 24 Jun 2011
1 answer
494 views
Can you statically define a column in a radgrid, dynamically add another column, and then manipulate either column in the grid's ItemDataBound event?

First I statically defined a RadGrid such as the following:

<telerik:RadGrid ID="grdResults" Height="100%" runat="server" OnNeedDataSource="grdResults_NeedDataSource" OnItemDataBound="grdResults_ItemDataBound" GridLines="None" AllowSorting="true" AllowPaging="false" AutoGenerateColumns="false">
    <ClientSettings>
        <Scrolling AllowScroll="true" UseStaticHeaders="true" SaveScrollPosition="false" />
        <Selecting AllowRowSelect="true" />
    </ClientSettings>
    <MasterTableView>
        <Columns>             
          
<telerik:GridBoundColumn HeaderText="StatusCodeDescription" UniqueName="StatusCodeDescription" DataField="StatusCodeDescription" HeaderStyle-Width="8%"></telerik:GridBoundColumn>
  
        </Columns>
    </MasterTableView>
</telerik:RadGrid>


then dynamically add a column in the page load like:

if (!Page.IsPostBack)
{
    var boundColumn = new GridBoundColumn();
    e.GridColumns.Add(boundColumn);
 
    boundColumn.HeaderText = "Select";
    boundColumn.DataField = "Id";
    boundColumn.UniqueName = "selectId";
}

and still use the ItemDataBound event to manipulate the dynamically added column?  
I can retrieve and manipulate the statically defined column, but I am unable to do the same for the 
dynamically added column?  

What am I doing wrong?


private void GridItemDataBound(object sender, GridItemEventArgs e)
{
    if (e.Item is GridDataItem)
    {
        var item = (GridDataItem)e.Item;
        item["selectId"].Text = "test";
 
     if (item["StatusCodeDescription"].Text.Length > 5)
            item["StatusCodeDescription"].Text = item["StatusCodeDescription"].Text.Substring(0, 2) + "...";
   }
}

Shinu
Top achievements
Rank 2
 answered on 24 Jun 2011
2 answers
73 views
Hi,

I want to click on the Scheduler MonthView one day, DayView don't show,Is through the attribute to set or through the events to set.

Thanks a lot!!

Regards

zh2yu
Top achievements
Rank 1
 answered on 24 Jun 2011
7 answers
191 views
Hi,

As mentioned in a previous thread, am using the solution in this thread to hide/ unhide columns.

In my scenario, out of the 10 columns in the grid am displaying 6 when am first loading the page. Am using checkboxes to hide/unhide each column.

Am facing a problem displaying the columns that are hidden on pageload. Am able to hide/unhide the 6 columns that are displayed on page load. Am guessing this might be due to the viewstate too.

Any suggestions to fix this would be helpful.

Thank you.
David
Top achievements
Rank 1
 answered on 23 Jun 2011
2 answers
96 views
When I set the width of a RadEditor in a RadGrid, the content area is wider than the Editor (I mean I have an horizontal scrollbar). How could I avoid that?

My code to set the Editor's width is:

protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
{
            if (e.Item is GridEditableItem && e.Item.IsInEditMode)
            {
                GridEditableItem editedItem = e.Item as GridEditableItem;
                GridHTMLEditorColumnEditor editor = (GridHTMLEditorColumnEditor) editedItem.EditManager.GetColumnEditor(colName);
                editor.Editor.Width = Unit.Pixel(750);
           [...]
jc mag
Top achievements
Rank 1
 answered on 23 Jun 2011
7 answers
284 views
I have a Radgrid Control on my aspx page with one hyperlink column I bind my grid with my datatable.  But the hyperlink column data will point to different urls, depends on its value. I need to check  the values on every rowbound and then setup the url for that row. How do I do that.
ervin
Top achievements
Rank 1
 answered on 23 Jun 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?