Telerik Forums
UI for ASP.NET AJAX Forum
8 answers
606 views
Hi,

In my current project I have a RadGrid with multilevel grouping of items.

The items displayed on the RadGrid are stored in a DataSet.

When any of items in the DataSet changes (because of some operations on the web page), I redisplay the RadGrid as follows:

this.RadGrid.DataSource = DataSet;
this.RadGrid.DataBind();

However, this causes all the RadGrid items to be collapsed (if any of them has been expanded).

Can you please show me how to redisplay the updated DataSet on the RadGrid and at the same time preserving the expanded items?

Please note that all operations need to be done on the server (instead of client)?

Regards,
Herman
Herman Gouw
Top achievements
Rank 2
 answered on 21 Oct 2010
2 answers
94 views
Hi there,

I really like the telerik ajax tools, but I have a slight problem now: the property value of a subobject is not displayed in the grid: Status.Shortcut. Pasting the json code (extracted by fiddler2) into a json viewser, looks ok.

Telerik-Version: v.2010.2.929.35

Even when creating a client side array, it doesn't display subobject's values.

Alerting the field says: ok - is there.


WHAT CAN I DO? Please help.

Thank you very much.

Client-Side DataBinding:
function UpdateGrid(rows) {
            clearError();
            var grid = $find("<%=gridTickets.ClientID %>");
            var mtv = grid.get_masterTableView();
  
            alert(rows[0].Status.Shortcut); //  <--WORKS GREAT!!!!
  
            mtv.set_dataSource(rows);
            mtv.dataBind();
            return;
        }


Page.aspx:
<telerik:RadGrid ID="gridTickets" runat="server" >
    <MasterTableView DataKeyNames="Id">
        <Columns>
            <telerik:GridBoundColumn DataField="Id" HeaderText="Id" Display="false" />
            <telerik:GridBoundColumn DataField="Status.Shortcut" HeaderText="Status" />
            <telerik:GridBoundColumn DataField="Subject" HeaderText="Betreff" />
        </Columns>
    </MasterTableView>
</telerik:RadGrid>


The JSONed Data

{
  "d": [
    {
      "__type": "Ticket:#TicketWeb.Entities",
      "Area": {
        "__type": "TicketArea:#TicketWeb.Entities",
        "Id": 0,
        "Name": "test",
        "Shortcut": "test"
      },
      "AreaId": 0,
      "Comments": null,
      "CostCenter": null,
      "CostCenterId": 0,
      "Created": "\/Date(1287085525987+0200)\/",
      "DontSendMailsAtInsert": false,
      "DueDate": null,
      "Duration": 0,
      "FinishDate": null,
      "From": null,
      "FromId": 0,
      "Guid": "6d9ac3f8-2bd4-4338-83cc-e85375e90039",
      "Id": 0,
      "InCharge": null,
      "InChargeId": 0,
      "LegacyId": null,
      "LegacyUid": null,
      "Logs": null,
      "ParentTicket": null,
      "ParentTicketId": 0,
      "PercentFinished": 0,
      "PhoneNumber": null,
      "Priorities": [
        {
          "__type": "Priority:#TicketWeb.Entities",
          "Value": 0
        },
        {
          "__type": "Priority:#TicketWeb.Entities",
          "Value": 1
        },
        {
          "__type": "Priority:#TicketWeb.Entities",
          "Value": 2
        },
        {
          "__type": "Priority:#TicketWeb.Entities",
          "Value": 3
        }
      ],
      "Priority": 0,
      "Reason": null,
      "ReceivedDate": null,
      "Responsible": null,
      "ResponsibleId": 0,
      "Revision": 0,
      "SortIndex": 0,
      "Specification": null,
      "StartDate": null,
      "Status": {
        "__type": "Status:#TicketWeb.Entities",
        "Id": 0,
        "MarksFinish": false,
        "MarksStart": false,
        "MarksStatusForNewSubProjects": false,
        "Name": "testkaka",
        "SetForNewTickets": false,
        "Shortcut": "kakakka",
        "SortIndex": 0
      },
      "StatusId": 0,
      "SubProjects": null,
      "Subject": "HI",
      "TicketReasonId": 0,
      "TicketType": null,
      "TicketTypeId": null,
      "TypeOfCosts": null,
      "TypeOfCostsId": 0
    }
  ]
}
Nikolay Rusev
Telerik team
 answered on 21 Oct 2010
1 answer
329 views
I have a very simple Grid that includes a hyperlink column using an image as the link:

<telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="sds_Credentials" GridLines="None" Skin="WebBlue" AllowSorting="True" Width="800px">
<MasterTableView AutoGenerateColumns="False" DataKeyNames="IDCredentials" DataSourceID="sds_Credentials">
<CommandItemSettings ExportToPdfText="Export to Pdf"></CommandItemSettings>
<RowIndicatorColumn>
<HeaderStyle Width="20px"></HeaderStyle>
</RowIndicatorColumn>
<ExpandCollapseColumn>
<HeaderStyle Width="20px"></HeaderStyle>
</ExpandCollapseColumn>
    <Columns>
        <telerik:GridBoundColumn DataField="CredentialName" HeaderText="Credential" 
            SortExpression="CredentialName" UniqueName="CredentialName">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="UserLogin" HeaderText="Login" 
            SortExpression="UserLogin" UniqueName="UserLogin">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="UserPassword" HeaderText="Password" 
            SortExpression="UserPassword" UniqueName="UserPassword">
        </telerik:GridBoundColumn>
        <telerik:GridHyperLinkColumn DataNavigateUrlFields="Website" HeaderText=" "
            DataNavigateUrlFormatString="{0}"
            UniqueName="Website" AllowFiltering="False" ItemStyle-HorizontalAlign="Center">
        <ItemStyle Width="50px" CssClass="radgrid" />
        </telerik:GridHyperLinkColumn>
        <telerik:GridHyperLinkColumn DataNavigateUrlFields="IDCredentials" HeaderText=" "
            DataNavigateUrlFormatString="credentials_details.aspx?IDCredentials={0}" 
            Text="Details" UniqueName="IDRolodex" AllowFiltering="False" ItemStyle-HorizontalAlign="Center">
        <ItemStyle Width="75px" CssClass="tbltdbutton" />
        </telerik:GridHyperLinkColumn>
        </Columns>
    </MasterTableView>
</telerik:RadGrid>

Code behind:

Protected Sub RadGrid1_ItemDataBound1(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid1.ItemDataBound
    If TypeOf e.Item Is GridDataItem Then
        Dim item As GridDataItem = DirectCast(e.Item, GridDataItem)
        Dim hyplnk As HyperLink = DirectCast(item("Website").Controls(0), HyperLink)
        hyplnk.ImageUrl = "../../../images/iconIE.gif"
        hyplnk.Target = "_blank"
    End If
End Sub

This works great.

However, I would like to hide the image if there is no hyperlink in the data field. Something like:


Protected Sub RadGrid1_ItemDataBound1(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid1.ItemDataBound
    If TypeOf e.Item Is GridDataItem Then
        Dim item As GridDataItem = TryCast(e.Item, GridDataItem)
        Dim value As String = item("Website").Text
        If value < "1" Then
            Dim hLink As HyperLink = DirectCast(item("Website").Controls(0), HyperLink)
            hLink.ImageUrl = "../../../images/iconIE.gif"
            hLink.Target = "_blank"
            hLink.Visible = False
        End If
    End If
  
End Sub

This does not work. Any help would be much appreciated.

Princy
Top achievements
Rank 2
 answered on 21 Oct 2010
1 answer
66 views
hi,
im not sure this is the right place..
anyway, i'm having some problems with callback function of a webservice..

i'm calling the next webservice for example..
Services.Action(param, onComplete)...

function onComplete(res)
{
alert('success');
}
and for some reason the callback function doesnt always called...

i try to change the web service so it wont accept a parameter...
and called it like this: Services.Action(onComplete)...
and this time the callback function was called..

anyone got an idea, what the problem could be?
Fiko
Telerik team
 answered on 21 Oct 2010
2 answers
178 views
Hi,

Here I am facing problem related to RadWindow in RadTabStrip with Contaxt Menu. As I have managed RadWindow Open functionality through code behind on Itemclick of Contaxt menu. On each click of contaxt menu in RadGrid I need to open RadWindow. But here once I open the RadWindow in one Grid through contaxt menu and after closing it when I go for next Tab then last radwindow load automatically.

This my code how I am managing radwindow thru code behind onItemclick of contaxt menu:

protected

 

 

void rcmFormContextMenu_ItemClick(object sender, RadMenuEventArgs e)

 

{

 

 

if (rtsEditEntity.SelectedTab.Value == "6")

 

{

 

 

int _formId = Convert.ToInt32(hiddenFormId.Value);

 

 

 

RadWindow rwForm = new RadWindow();

 

rwForm.ID =

 

"RadWindow1";

 

 

 

rwForm.NavigateUrl = "~/FormsViews/EditForm.aspx";

 

rwForm.VisibleOnPageLoad =

 

true;

 

rwForm.Modal =

 

true;

 

rwForm.Overlay =

 

true;

 

rwForm.Behaviors =

 

WindowBehaviors.Close;

 

rwForm.Width = 1000;

rwForm.Height = 650;

 

 

if (rwmForm.Windows.Count > 0)

 

{

rwmForm.Windows.RemoveAt(0);

}

rwmForm.Windows.Add(rwForm);

}

}

 

 

protected void rcmViewContextMenu_ItemClick(object sender, RadMenuEventArgs e)

 

{

 

 

if (rtsEditEntity.SelectedTab.Value == "5")

 

{

 

 

int _ViewId = Convert.ToInt32(hiddenViewId.Value);

 

 

 

RadWindow rwView = new RadWindow();

 

rwView.ID =

 

"RadWindow2";

 

 

 

rwView.NavigateUrl = "~/FormsViews/EditView.aspx";

 

rwView.VisibleOnPageLoad =

 

true;

 

rwView.Modal =

 

true;

 

rwView.Overlay =

 

true;

 

rwView.Behaviors =

 

WindowBehaviors.Close;

 

rwView.Width = 1000;

rwView.Height = 650;

 

 

if (rwmView.Windows.Count > 0)

 

{

rwmView.Windows.RemoveAt(0);

}

rwmView.Windows.Add(rwView);

}

}



I don't understand how it will happend?
Please assist me.

Thanks & Regards,

Kaushal Jani
Kaushal
Top achievements
Rank 1
 answered on 21 Oct 2010
3 answers
122 views
Good day!
I have a grid on page, it has width 100% and height 100%
The grid is contained in a div. When I change pagimng size or when I go through pages in pagin height of the grid changes but the div's height does not =(   And it looks bad. How can I make div change size on grid changing size? What RadGrids client events should I use for it?
lina fetisova
Top achievements
Rank 1
 answered on 21 Oct 2010
4 answers
144 views
Hello,

I need to have a grid in popup.

How do I create,bind, iterate items in the grid in popup?

Thank you

Regards
Raj
Rajz
Top achievements
Rank 1
 answered on 21 Oct 2010
1 answer
65 views
Hi,

I am using a RadDatePicker in a setup that is similar to the ActiveSkill example (i.e. a RadSplitter with two RadPanes), the right most
RadPane is the destination pane for my custom control that is loaded by Page.LoadControl and added by Page.Controls.Add().

Now I noticed that if I create a custom control with only a RadDatePicker in it, the calender popup button does not do anything,
if I move the control to the page with the RadPanes and the RadSplitter (i.e. out of the custom control) it works fine.

What am I missing?

Thanks,
-Carlo
Carlo
Top achievements
Rank 1
 answered on 21 Oct 2010
3 answers
128 views

Hi,

my requirement is to export all my grid on my page to word file.
i have 3 grid on my page and on export button click i want to export the data of all grid into word file.

please help.
Daniel
Telerik team
 answered on 20 Oct 2010
4 answers
258 views

Hi,

Is there a way to open a radgrid popup add form on page load? 

I want to reproduce the same action as when the user click "Add a new record" in the grid.

Thank you.

Aaron
Top achievements
Rank 2
 answered on 20 Oct 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?