I am having trouble adding a GridEditCommandColumn or GridHyperLinkColumn to a grid control that is bound clientside via a web service. When I add either of these type columns the columns appear empty.
There are several search fields. When the user presses the Search button the form is submitted and on the server side, the grid is bound to a blank datasource. On the client side, the OnGridCreated event triggers a call to a web service that returns the data for the grid and then binds it. From there, all paging and sorting is done client side.
Here is what I think is the pertinent code. I am also including a screenshot showing part of the resulting grid.
The Grid:
| <telerik:RadGrid ID="gridResults" runat="server" Visible="false" AutoGenerateColumns="false" EnableViewState="true" |
| SkinID="CR" GridLines="None" HeaderStyle-HorizontalAlign="left" PageSize="20" |
| AllowAutomaticUpdates="false" OnUpdateCommand="gridResults_UpdateCommand" |
| AllowPaging="True" PagerStyle-Position="Bottom" PagerStyle-Mode="NextPrev" AllowSorting="true"> |
| <ClientSettings> |
| <ClientEvents OnGridCreated="gridResults_GridCreated" OnCommand="gridResults_Command" OnRowDataBound="RowDataBound" /> |
| </ClientSettings> |
| <MasterTableView DataKeyNames="ID" EnableNoRecordsTemplate="false" PagerStyle-AlwaysVisible="true" Visible="true" |
| ShowFooter="false" AutoGenerateColumns="false" AllowPaging="true" FooterStyle-Font-Bold="true" EditMode="PopUp" > |
| <Columns> |
| <telerik:GridEditCommandColumn ButtonType="PushButton" UniqueName="EditTicket"></telerik:GridEditCommandColumn> |
| <telerik:GridHyperLinkColumn HeaderText="link" DataTextField="ID" DataNavigateUrlFields="ID" UniqueName="EditTicket" DataNavigateUrlFormatString="EditAsset.aspx?AssetID={2}"></telerik:GridHyperLinkColumn> |
| <telerik:GridBoundColumn DataField="ID" HeaderText="Ticket #" SortExpression="ID" UniqueName="ID" HeaderButtonType="TextButton"><ItemStyle Wrap="false" /></telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="StatusName" HeaderText="Status" SortExpression="tsitil.StatusName" HeaderButtonType="TextButton"></telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="Category" HeaderText="Category" SortExpression="tc.Code" HeaderButtonType="TextButton"></telerik:GridBoundColumn> |
| </Columns> |
| <EditFormSettings EditFormType="Template" CaptionDataField="ID" CaptionFormatString="Change Status For Ticket: {0}" PopUpSettings-Modal="true"> |
| <FormTemplate> |
| ... |
| </FormTemplate> |
| </EditFormSettings> |
| </MasterTableView> |
| </telerik:RadGrid> |
The Server Side Search Button:
| protected void btnSearch_Click(object sender, EventArgs e) |
| { |
| //Here is where the search criteria are built and then written to javascript so they can be sent to the web service |
| gridResults.DataSource = new int[] { }; |
| gridResults.DataBind(); |
| gridResults.Visible = true; |
| return; |
| } |
The javascript that binds the results of the web service to the grid:
| function UpdateGrid(result) { |
| var tableView = $find("<%= gridResults.ClientID %>").get_masterTableView(); |
| var objData = result["d"]; |
| var count = objData["Count"]; |
| tableView.set_virtualItemCount(count); |
| tableView.set_dataSource(objData["Data"]); |
| tableView.dataBind(); |
| } |
Is it possible to have an GridEditCommandColumn on a grid that is using client side binding? I am willing to have the popup edit do a postback but I would like to continue binding the grid client side. The Grid / Client Side demo shows that you can use a hyperlink column in a client side grid but I am not sure of the exact format I would need to return from my webservice. Does anyone know if this is documented somewhere? The important part though is to have a GridEditCommandColumn. Is this possible?
Thanks for any help,
Blake
| for (i = 0; i <= dtable.Rows.Count - 1; i++) |
| { |
| DDEvent.Items.Add(new RadComboBoxItem("text", "value"); |
| } |
| DDEvent.SelectedIndex = 0 |
| protected void RadMultiPage1_PageViewCreated(object sender, RadMultiPageEventArgs e) |
| { |
| Control pageViewContents = LoadControl(e.PageView.ID + "CS.ascx"); |
| pageViewContents.ID = e.PageView.ID + "userControl"; |
| e.PageView.Controls.Add(pageViewContents); |
| } |
hello to all,
thanks again to sir shinu,
I would to ask help once again about passing parameter from another page to the radwindow with a grid inside, here's my scenario i have one page contains textboxes that user will input numbers to search the details related to the numbers inputed, for example the user input 123 to the txtbox name TxtAccountNumber.Text then he will click the button Search coming from page then a radwindow will popup with a grid inside then load the record coming from the database.. how can i do that i tried to put the value from session inside the page but when the radwindow pop up the parameter there is null so its means no value has been carried by my session variable. anyway here's my code. please check and revise if ever..
<
telerik:RadWindowManager ID="RadWindowManager1" runat="server">
<Windows>
<telerik:RadWindow ID="RadWindow1" runat="server" Skin ="Vista" ReloadOnShow ="true"
Modal ="true" OpenerElementID ="<%#btnSearch.ClientID%>"
Title ="Transactional" NavigateUrl ="~/CHS/CHSTransactional.aspx?Accountno='123456789'" Width ="580px" Height ="300px" >
</telerik:RadWindow>
</Windows>
</telerik:RadWindowManager>
sample/codes is highly appriciated.
thanks to all