I have a gird on web user control and bind this grid from clientside and serverside both.
i have created a public method on web user control and calling this method from aspx page and
passing datarow[] in this method to bind.
i am calling Client ItemDataBound event of grid. when i am binding this grid clientside then it is working fine but
when i am calling serverside binding method of web user control from aspx page then
items are not showing in the grid..
Why this type of problem is occuring, i am unable to understand.
Does any one knows please tell me ASAP...
Thanks & Regards
Brijendra Pandey
3 Answers, 1 is accepted
Could you post your aspx, ascx and code-behind. It is important to know how exactly the grid is being data-bound. Please, use the Code Formatter tool of the html editor.
Thanks.
Regards,
Tsvetoslav
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
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.
Thanks & Regards
Brijendra Pandey
I am sorry to repeat my request but could you post your complete code for the aspx form and user control, not just code-snippets from the mark-up and code behind. And once again, please, use the Code Formatter tool of the html editor you are entering the text - this is the right most tool bar paint button. Otherwise, as you can see from your last post, the code is unreadable and difficult to understand.
I'd also suggest that you open up a support ticket and send us a test project that we can run our side and get back to your with more information.
Thank you.
Greetings,
Tsvetoslav
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.