This is a migrated thread and some comments may be shown as answers.

[Solved] Grid not showing Items

3 Answers 132 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Praveen Rustagi
Top achievements
Rank 1
Praveen Rustagi asked on 26 Aug 2009, 04:45 AM
I have already posted this thread by my personal id.
then u ask the web user control and page.
This is as follows :

 

Web user control markup is this :

 

 

 

function Enquiry_Grid_RowDataBound(sender, args) {

 

 

 

 

var createCheckBox = "<input type='checkbox' id='chk_" + args.get_item()._itemIndexHierarchical + "'/>";

 

args.get_item()._element.cells[0].innerHTML = createCheckBox;

}

 

 

 

function Enquiry_Grid_RowDblClick(sender, args) {

 

 

 

try {var grid = sender;

 

 

 

var MasterTable = grid.get_masterTableView();

 

 

 

var rowIndex = args.get_itemIndexHierarchical();

 

 

 

var row = MasterTable.get_selectedItems()[0];
var crmTransactionId = MasterTable.getCellByColumnUniqueName(row, "int_crm_transaction_id").innerText;

 

}

 

 

 

<telerik:RadGrid ID="grdEnquires" BorderStyle="None" Height="150px" AllowMultiRowSelection="false"

 

 

 

runat="server" Skin="Office2007" Width="100%" AutoGenerateColumns="False" GridLines="None">

 

 

<%

--OnItemDataBound="grdEnquires_ItemDataBound">--%>

 

 

 

<ClientSettings>

 

 

 

<Scrolling AllowScroll="true" UseStaticHeaders="True" />

 

 

 

<Selecting AllowRowSelect="True" />

 

 

 

<ClientEvents OnRowDataBound="Enquiry_Grid_RowDataBound" OnRowDblClick="Enquiry_Grid_RowDblClick" />

 

 

 

</ClientSettings>

 

 

<%

--<HeaderStyle CssClass="gridHeader" />--%>

 

 

 

<MasterTableView CommandItemDisplay="None" TableLayout="Fixed" EditMode="EditForms"

 

 

 

AutoGenerateColumns="False" DataKeyNames="int_crm_transaction_id" runat="server"

 

 

 

ClientDataKeyNames="int_crm_transaction_id" NoDetailRecordsText="" NoMasterRecordsText="">

 

 

 

<Columns>

 

 

 

<telerik:GridTemplateColumn HeaderText="" HeaderStyle-Width="30px">

 

 

<%

-- <HeaderTemplate>

 

<input type="checkbox" onclick="SelectAll();" id="chkSelectAll" /></HeaderTemplate>--

 

 

%>

 

 

 

<ItemTemplate>

 

 

 

<input type="checkbox" id="chkSelect" runat="server" />

 

 

 

</ItemTemplate>

 

 

 

</telerik:GridTemplateColumn>

 

 

 

<telerik:GridBoundColumn DataField="int_customer_id" HeaderText="Customer ID" SortExpression="int_customer_id"

 

 

 

UniqueName="int_customer_id" Display="false">

 

 

 

</telerik:GridBoundColumn>

 

 

 

</Columns>

 

 

 

</MasterTableView>

 

 

 

</telerik:RadGrid>

 

 

Code Behind is This: 

 

 

 

public void BindInquiryRequest(DataRow[] dr)

 

{

 

grdEnquires.DataSource = dr;

 

grdEnquires.DataBind();

}

 

 

.ASPX page Markup is THIS:

 

 

<asp:ScriptManager ID="sm" runat="server" ScriptMode="Release" LoadScriptsBeforeUI="false">

 

 

 

<Services>

 

 

 

<asp:ServiceReference Path="~/Services/GetData.asmx" />

 

 

 

</Services>

 

 

 

</asp:ScriptManager>

 

 

 

 

 

 

 

 

<asp:UpdatePanel ID="up" runat="server">

 

 

 

<ContentTemplate>

 

 

 

<asp:Panel ID="Panel1" runat="server" Width="100%" CssClass="panelBar">

 

 

 

<asp:Label ID="Label1" runat="server" Text="Inquiry/Request"></asp:Label>

 

 

 

</asp:Panel>

 

 

 

<asp:Panel ID="Panel2" runat="server" CssClass="collapsePanel" BackColor="White"

 

 

 

Font-Size="8" ScrollBars="None" Width="100%">
<uc:InquiryRequestList ID="ucInquiryRequest" runat="server" Height="100" />

 

 

 

</asp:Panel>
</ContentTemplate>

 

 

 

</asp:UpdatePanel>

 

 

 

 

Code Behind is this :

 

 

 

DataRow[] dr = ((DataSet)wsGetData.GlobalSearch(searchIn, searchValue)).Tables[0].Select("int_crm_transaction_id not like 'CMP%'");

 

ucInquiryRequest.BindInquiryRequest(dr);

 

 

and except this one other problem is this : i have taken a input button not runat="server" and i export grid to excel it was doing postback, but i don't want post back.
button markup is this:

 

 

 

function Inquiry_ExportToExcel() {

 

 

 

 

var grid = $find("<%=grdEnquires.ClientID %>").get_masterTableView();

 

grid.exportToExcel();

return false;

 

}

 

<

 

 

input type="button" id="btnExport1" value="Export" style="width:50px;" causesvalidation="false" onclick="Inquiry_ExportToExcel();" />


Please solve my problem. I am awaiting of your kind response.

3 Answers, 1 is accepted

Sort by
0
Sebastian
Telerik team
answered on 28 Aug 2009, 01:08 PM
Hello Praveen,

I am not sure where you already posted this thread because I was not able to find it under your account's support history.

I reviewed your code implementation and here are my findings:

  1. You intercepted the RowDataBound client of the grid (to inject checkboxes in its column cells) and at the same time bind the control on the server. Note that this event is meaningful and will be fired with client-side binding only.

    Hence you should either switch to client-side binding or modify your logic to add the textboxes on the server if necessary.
  2. Grid export is achievable with postbacks only because part of the export logic requires the grid to be re-rendered. The client exportToExcel method allows you to trigger export operation from the client but still it will be processed server-side.
Kind regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
tim
Top achievements
Rank 1
answered on 28 Aug 2009, 07:09 PM
I'm having a display issue as well.  Trying to follow the drag and drop demo, i have:

 protected void grdAvailActions_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
    {
        IList<ActionItems> _ActionItems = getActions();
        grdAvailActions.DataSource = _ActionItems;
    }

When I run, the get a grid with the appropriate number of rows, but no text showing up.  Here's the HTML source:

<table cellspacing="0" class="rgMasterTable rgClipCells" border="0" id="ctl00_ContentPlaceHolder1_grdAvailActions_ctl00" style="width:95%;table-layout:fixed;overflow:hidden;empty-cells:show;">
	<colgroup>
		<col />
	</colgroup>
<tbody>
	<tr class="rgRow" id="ctl00_ContentPlaceHolder1_grdAvailActions_ctl00__0">
		<td>&nbsp;</td>
	</tr><tr class="rgAltRow" id="ctl00_ContentPlaceHolder1_grdAvailActions_ctl00__1">
		<td>&nbsp;</td>
	</tr><tr class="rgRow" id="ctl00_ContentPlaceHolder1_grdAvailActions_ctl00__2">
		<td>&nbsp;</td>
	</tr><tr class="rgAltRow" id="ctl00_ContentPlaceHolder1_grdAvailActions_ctl00__3">
		<td>&nbsp;</td>
	</tr><tr class="rgRow" id="ctl00_ContentPlaceHolder1_grdAvailActions_ctl00__4">
		<td>&nbsp;</td>
	</tr><tr class="rgAltRow" id="ctl00_ContentPlaceHolder1_grdAvailActions_ctl00__5">
		<td>&nbsp;</td>
	</tr><tr class="rgRow" id="ctl00_ContentPlaceHolder1_grdAvailActions_ctl00__6">
		<td>&nbsp;</td>
	</tr><tr class="rgAltRow" id="ctl00_ContentPlaceHolder1_grdAvailActions_ctl00__7">
		<td>&nbsp;</td>
	</tr><tr class="rgRow" id="ctl00_ContentPlaceHolder1_grdAvailActions_ctl00__8">
		<td>&nbsp;</td>
	</tr>
	</tbody>

</table>

Thanks.



0
Vlad
Telerik team
answered on 31 Aug 2009, 08:35 AM
Hi tim,

Do you have any columns defined for this grid?

Best wishes,
Vlad
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Grid
Asked by
Praveen Rustagi
Top achievements
Rank 1
Answers by
Sebastian
Telerik team
tim
Top achievements
Rank 1
Vlad
Telerik team
Share this question
or