I'm having huge problems loading data into a grid. i've encountered a number of problems, which i´ve been solving through different approachs, and now i dont have any exception, but i still cant load the data into the grid.
The data is filtered according to "rdpInvestigado r" external selectedValue, and should load in the grid accordingly.
I use a n-layer architecture and ASP ObjectDataSourc e to Bind DB.
I will put the main parts of the code, in order to be possible to understand and find the issue. I will also attach an image with the appearence of the system, and a sample code containing a more complete file, but still imcomplete because i'm working on a larger application that i cant replicate on my machine.
I believe the problem is on CS code, but it could also be on the BLL "GetList" method. Can you identify where the problem is?
//HTML - <script type="text/javascript">
-
function refreshGrid(arg) {
-
var radManager = $find('<%=
-
RadAjaxManager.GetCurrent(Page).ClientID %>');
-
if (!arg) {
-
radManager.ajaxRequest("Rebind");
-
}
-
else {
-
radManager.ajaxRequest(arg);
-
}
-
}
-
-
function myUserControlClickHandler() {
-
$find("<%= RadAjaxManager.GetCurrent(Page).ClientID %>").ajaxRequest("FromUserControl"); }
-
</script>
-
-
<telerik:RadComboBox ID="rdpInvestigador" </telerik:RadComboBox>
-
-
<telerik:RadButton ID="ButtonPerformSearch" Text="Aceder à listagem de timesheets" ValidationGroup="search" OnClick="ButtonPerformSearch_Click"
-
runat="server" CssClass="btn btn-mini" Width="50%" ButtonType="ToggleButton"
-
CausesValidation="true"></telerik:RadButton>
-
<asp:LinkButton ID="lkbPesquisar" runat="server" CssClass="btn btn-mini" OnClick="lkbPesquisar_Click">pesquisar</asp:LinkButton>
-
-
<telerik:RadGrid ID="gvTimesheets" DataSourceID="DataSourceTimesheets" OnSelectedIndexChanged="rdpInvestigador_SelectedIndexChanged" OnItemCommand="gvTimesheets_ItemCommand"
-
-
<asp:ObjectDataSource ID="DataSourceTimesheets" runat="server" EnablePaging="True" OnSelecting="DataSourceTimesheets_Selecting" SortParameterName="sortType" TypeName="UMinho.GestaoProjectos.BLL.BLLListagemTimesheets"
-
SelectMethod="GetList" SelectCountMethod="GetListCount">
-
<SelectParameters>
-
<asp:ControlParameter ControlID="rdpInvestigador" Name="IDRecursoHumano" PropertyName="SelectedValue" DefaultValue="" Type="Int32" />
-
<asp:Parameter Name="ID" Type="Int32" />
-
<asp:Parameter Name="DataEnvio" Type="datetime" />
-
<asp:Parameter Name="IDEstadoTimesheet" Type="Int32" />
-
<asp:Parameter Name="AssinaturaTimesheet" Type="string" />
-
<asp:Parameter Name="Observações" Type="string" />
-
<asp:Parameter Name="Ficheiro" Type="string" />
-
<asp:Parameter Name="FileTipo" Type="string" />
-
<asp:Parameter Name="FileContent" Type="Byte" />
-
<asp:Parameter Name="login" Type="String" />
-
</SelectParameters>
-
</asp:ObjectDataSource>
//BLL method, used in object data source (wanted data that not load is "listagem timesheet" - public List<ListagemTimesheet> GetList(int? ID, int? IDRecursoHumano, DateTime? DataEnvio, string AssinaturaTimesheet,int? IDEstadoTimesheet, string Observações, string Ficheiro, string FileTipo, byte FileContent, string sortType, int maximumRows, int startRowIndex, string login)
-
{
-
using (GestaoProjectosEntities db = new GestaoProjectosEntities())
-
{
-
var entities = from e in db.ListagemTimesheets
-
select e;
-
-
entities = GetQueryList(entities, ID, IDRecursoHumano, DataEnvio, AssinaturaTimesheet, IDEstadoTimesheet, Observações, Ficheiro, FileTipo, FileContent, login);
-
-
entities = GetListSort(entities.AsQueryable(), sortType);
-
-
entities.Skip(startRowIndex).Take(maximumRows);
-
-
return entities.ToList();
-
}
-
}
-
-
public int GetListCount(int? ID, int? IDRecursoHumano, DateTime? DataEnvio, string AssinaturaTimesheet,int? IDEstadoTimesheet, string Observações, string Ficheiro, string FileTipo, byte FileContent, string login)
-
{
-
using (GestaoProjectosEntities db = new GestaoProjectosEntities())
-
{
-
var entities = from e in db.ListagemTimesheets
-
select e;
-
-
return GetQueryList(entities, ID, IDRecursoHumano, DataEnvio, AssinaturaTimesheet, IDEstadoTimesheet, Observações, Ficheiro, FileTipo, FileContent, login).Count();
-
}
-
}
// Cs class, with 3 approachs: 1-FormsMode; 2-OnSelectedIndex (); 3-DataBind() - public Utils.FormMode FormMode
-
{
-
get { return ViewState["___formmode"] == null ? Utils.FormMode.CreateMode : (Utils.FormMode)ViewState["___formmode"]; }
-
-
set { ViewState["___formmode"] = value; }
-
}
-
//ID
-
public int ID
-
{
-
get { return ViewState["___entitypk"] == null ? 0 : (int)ViewState["___entitypk"]; }
-
-
set { ViewState["___entitypk"] = value; }
-
}
-
-
BLLListagemTimesheets listagembll = new BLLListagemTimesheets();
-
BLLPesquisarTimesheet pesquisarbll = new BLLPesquisarTimesheet();
-
BLLTemplateFile templatebll = new BLLTemplateFile();
-
-
protected void Page_Load(object sender, EventArgs e)
-
{
-
//Get reference to AjaxManager (from Master)
-
var manager = RadAjaxManager.GetCurrent(Page);
-
-
//Create a new delegate to handle the AjaxRequest event
-
//manager.AjaxRequest += new RadAjaxControl.AjaxRequestDelegate(RadAjaxManager1_AjaxRequest);
-
-
//Add your ajax settings programmatically (with ref to Master manager)
-
manager.AjaxSettings.AddAjaxSetting(manager, gvTimesheets);
-
-
if (Request.QueryString["ID"] != null)
-
{
-
if (Request.QueryString["action"] != "TemplateFileDownload")
-
DownloadFile(Convert.ToInt32(Request.QueryString["ID"]));
-
else
-
ExportFile_Click();
-
}
-
-
else
-
{
-
if (!Page.IsPostBack)
-
{
-
RecursoHumano rh = new RecursoHumano();
-
-
rdpUnidade.DataValueField = "ID";
-
rdpUnidade.DataTextField = "NomeUnidade";
-
rdpUnidade.DataSource = new BLLUnidades().GetAllCentrosInvestigacao();
-
rdpUnidade.DataBind();
-
//rdpUnidade.ClearSelection();
-
-
// Sem filtros (Nao consigo utilizar o AjaxManager!) // new BLLProjectoEquipa().GetAll()
-
rdpInvestigador.DataSource = new BLLRecursoHumano().GetAll();
-
rdpInvestigador.DataValueField = "ID";
-
rdpInvestigador.DataTextField = "Nome";
-
rdpInvestigador.DataBind();
-
rdpInvestigador.Items.Insert(0, new RadComboBoxItem("", ""));
-
-
-
}
-
}
-
//2 approaches, 1st one
-
-
protected void ButtonPerformSearch_Click(object sender, EventArgs e)
-
{
-
gvTimesheets.Rebind();
-
}
-
-
protected void rdpInvestigador_SelectedIndexChanged(object sender, EventArgs e)
-
{
-
gvTimesheets.DataSource = rdpInvestigador.SelectedValue;
-
gvTimesheets.Rebind();
-
}
-
//Second
-
-
protected void lkbPesquisar_Click(object sender, EventArgs e)
-
{
-
BindInvestigadores();
-
}
-
-
private void BindInvestigadores() // gvTimesheets.DataBind(); nao dá exception mas nao carrega
-
{
-
-
gvTimesheets.DataBind();
-
}
After many tries, cant get any ideia of the problem
0 5867 Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Snake |
last post by:
I have a vb .net program which fills a data grid upon form load from an
acccess database. This works great. Now, I have to add a combo box and use
it to alter the underlying sql statement and re-fill the data grid. I have
never done this before, but I created a new sql statement in strSql from the
combobox, update the data adapter, and try...
|
by: atif |
last post by:
i m using webmatrix n i hav a prob with editable data grid. i hav set
the data grid with to 100% when i load the page the data grid fits
into the screen 100%. but when i clicked on add new or on update that
a horizontal scroll bar used to appear n i m unable to read all the
records i hav to scroll till to the end. Plz help me out
Posted...
|
by: Tejpal Garhwal |
last post by:
I have datagrid filled with some data rows. At the run time i want know how
many total rows are there in the data grid ?
Any idea ? Any Suggestions ?
Thanks in advance
Tej
|
by: Gian Paolo |
last post by:
this is something really i can't find a reason. I have a form with a
tabcontrol with tree pages, in the second page there is a Data GRid View.
Plus i have a class. When i open the form i "inizialize" the Data Grid View
(add a data sorce, filled with notthing at staratup, and hide some columns)
when i put a code in the txtCLCOD textbox start a...
|
by: jvdub22 |
last post by:
I am currently using a VB 6 MS Data Grid Control bound to an SQL express data base. My grid has 20 visible rows when I load my form, when I scroll down and select a row higher than 20 the grid refers back to the corresponding row in the original 1-20. For example I can select any row less than 20 just fine, but if I select row 22 the grid will...
| |
by: sumaira_it |
last post by:
Hi I am building window forms application.
i have made a design time data grid. I populated the data grid on
form load by fill method of adapter (Where Column1 = 1). I want that
when i click on update button the changes made to the data grid should
save in the table. I am a beginner. Please help me in this regard,
|
by: Rasika WIJAYARATNE |
last post by:
Hi everyone,
I have two grid-views and I am trying to populate the data on gv2
based on the selection in gv1. However when a row is selected in gv1,
it doesn't populate the gv2 with data. I have ensured that the
ObjectDataSource (ods2) for gv2 works and load data correctly by
specifying hardcoded primary key value within a Paramater.
...
|
by: newsaboutgod |
last post by:
I am loading a dataset from a XML file.
I want to allow the user to display data from the dataset in a grid.
Depending on which button they click i want to load the grid with a
subset of data from the dataset.
So, once I load the dataset from the XML file, how would I load the
grid with only the data from the dataset that had "smith" in...
|
by: vibhakhushi |
last post by:
Hi, I'm trying to load data to my grid panel which resides in php using JsonStore object. But the problem is JsonStore is not getting data from php only. Can anyone tell me where i've gone wrong. Is my php file is proper or not? I'm very new to both php and extjs. please help me out.
i'm uploading the both .js and .php files. please help me out....
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |