Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Saturday, June 28, 2025 
 
slxdeveloper.com Community Forums  
   
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
 Web Forums - SalesLogix Web Platform & Application Architect
Forum to discuss the use of the SalesLogix Web Platform, Client and Customer Portals, and the Application Architect (For version 7.2 and higher only). View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix Web Platform & Application Architect | New ThreadView:  Search:  
 Author  Thread: SlxGridView object always saying it has no rows? (7.5 Web)
Byrnes
Posts: 43
 
SlxGridView object always saying it has no rows? (7.5 Web)Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 23 Dec 08 3:26 PM
I'm in the middle of what has turned into an extremely aggravating customization that I would love some input on.

Our client has asked us to add a new 1:M tab to 'Contracts' titled 'Associated Accounts'. This is where they are allowed to lookup accounts and add as many as they want to the contract.

This works like a champ, no problem. (Resulted in a new table / entity named ContractAssocAccount.)

Now the client wants to find the correct 'Bill To' address searching against all associated accounts. My vision is this: Two new objects on the ContractDetail form: one would be a button that would open a new form that would show the correctly filtered addresses. The user would select an address from a gid and then a 'text-friendly' field would be updating showing the address that was selected on ContractDetail. Also a hidden BillToAddressID field would store the SalesLogix Address ID for backend purposes.

I'm about halfway done with this and I'm stuck dead in my tracks.

I have a new business rule on the Contract entity that accurately returns all 'Bill To' addresses from the Associated Accounts as an IList. It looks like:
======
public static void GetBillToChoicesStep1( Sage.Entity.Interfaces.IContract contract, out object result)
{
System.Collections.Generic.IListlst = new System.Collections.Generic.List();
foreach(IContractAssocAccount assoc in contract.ContractAssocAccounts)
{
foreach(IAddress adr in assoc.Account.Addresses)
{
if (adr.Description == "Bill To")
{
lst.Add(adr);
}
}
}
result = lst;
}
======

This BusinessRule is bound to the quickForm property 'Get By Method' and 'Get by Property' is blank, as I believe is correct on my new form - ContractSelectBillTo.

My button on ContractDetail does open the quickform (ContractSelectBillTo) and it IS populated with the correct addresses. So far, so good (as far as I can tell, anyway.)

Here is my rowCommand property that's embedded within my .ascx file:

======
protected void grdContracts_RowCommand(object sender, GridViewCommandEventArgs e)
{
if(e.CommandName=="Select")
{
// Convert the row index stored in the CommandArgument
// property to an Integer.
int index = Convert.ToInt32(e.CommandArgument);

GridViewRow selectedRow = grdContracts.Rows[index];
TableCell cellValue = selectedRow.Cells[1];
string sValue = cellValue.Text;

// Display the selected value to the textbox on the screen before closing and saving.
txtValue.Text = sValue;
}
}
======

I can't, however, find out which row was clicked - well, allow me to clarify. I know the index thanks to this line: int index = Convert.ToInt32(e.CommandArgument);
Unfortunately I always get the following error as soon as I try and access grdContracts:
"Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index"

I set my sValue to grdContracts.Rows.Count only to find it's perpetually 0! How is this possible when I have 4 legitimate records returned?

I then thought to myself, "Self, maybe I need to access the objects and not the grid!" only to always be given "Object reference not set to an instance of an object" when editing the above sub to be this:
======
protected void grdContracts_RowCommand(object sender, GridViewCommandEventArgs e)
{
if(e.CommandName=="Select")
{

// Convert the row index stored in the CommandArgument
// property to an Integer.
int index = Convert.ToInt32(e.CommandArgument);
string sValue = "1";
if (this.BindingSource != null)
{
Sage.Entity.Interfaces.IAddress address;
address = GetCurrentEntity() as Sage.Entity.Interfaces.IAddress;
sValue = address.Id.ToString();
}
else
{
sValue = "11";
}
txtValue.Text = sValue;
}
}
======

I've tried everything I can think of at this point to no avail and would love some suggestions if anyone actually took the time to read this ridiculous post.

Thanks fellas (and Merry Christmas!),

Byrnes
[Reply][Quote]
mark
Posts: 70
 
Re: SlxGridView object always saying it has no rows? (7.5.2 Web)Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 30 Jun 11 8:36 AM
fiogf49gjkf0d

Hi Byrnes,


I am trying to access the all  cell values (a currency column) in gridview on ok button click of a dialog service but i am facing the same issue that always when ever i tried to access numbers of rows i am always getting zero. Any One  lease Kindly Help. It is very important for me to finish this task.


 


Currency ct = (Currency)QFDataGrid.Rows[1].FindControl("QFDataGridcol2");


string currvalue = ct.Text;


 



I am getting Index out of Range Value Errors for the above code.

 





 



 



string rowcount = Convert.ToString(QFDataGrid.Rows.Count);

 


I am getting zero as value even though my gridview is having n number of rows.


PLease Help People!!!!!!!!!!!


Thanks in Advance


Mark


 


?


 


 


 


 

[Reply][Quote]
Raul A. Chavez
Posts: 1300
Top 10 forum poster: 1300 posts
 
Re: SlxGridView object always saying it has no rows? (7.5.2 Web)Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 30 Jun 11 8:43 AM
fiogf49gjkf0d

Keep in mind that the Grid may not be populated when the event that you are catching is being fired.


The best way to access the Data is to go down to the DataSource.


What I always do is the following:


  - Define a DataKey on the Grid. The DataKeys will always be available. So, if you have a Grid of Contacts and you set the DataKey as the ContactId, then you should be able to retreive the ContactID from the DataKey


  - From there, depending on the Event, and/or the Data source you are using, you could either search your Data Source, or instantiate an Object (in this example it would be an IContact object) and then retreive the field that you would be interested on.

[Reply][Quote]
mark
Posts: 70
 
Re: SlxGridView object always saying it has no rows? (7.5.2 Web)Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 30 Jun 11 9:36 AM
fiogf49gjkf0d

Thanks Raul!


 The Problem I am Facing is I have A grid on opp form.


 I am Populating the Grid Using Below Code.


 Sage.Platform.Data.IDataService service = Sage.Platform.Application.ApplicationContext.Current.Services.Get<Sage.Platform.Data.IDataServi();


  



String conn = service.GetConnectionString();


 


 




 System.Data.OleDb.OleDbConnection oleconn = new System.Data.OleDb.OleDbConnectio();






oleconn.ConnectionString = conn;


oleconn.Open();


System.Data.OleDb.


OleDbCommand cmd = new System.Data.OleDb.OleDbCommand();




cmd.Connection = oleconn;



//System.Data.SqlClient.SqlDataAdapter da = new System.Data.SqlClient.SqlDataAdapter();



System.Data.OleDb.OleDbDataAdapter da = new System.Data.OleDb.OleDbDataAdapter();




 






 



 


  
Sage.Entity.Interfaces.IOpportunity acc1 = this.BindingSource.Current as Sage.Entity.Interfaces.IOpportunity;








strsql1.Append("SELECT FEETYPE,FEECURRENCY from sysdba.adminfees where opportunityid = '" + acc1.Id + "'");



System.Data.OleDb.OleDbDataReader dr;








 cmd.CommandText = Convert.ToString(strsql1);





 d


r = cmd.ExecuteReader();

 

<SalesLogix:SlxGridView runat="server" ID="QFDataGrid" GridLines


="None"



 

AutoGenerateColumns="false" CellPadding="4" CssClass="datagrid" PagerStyle-CssClass


="gridPager"




AlternatingRowStyle-CssClass="rowdk" RowStyle-CssClass="rowlt" SelectedRowStyle-CssClass="rowSelected" ShowEmptyTable="true" EnableViewState


="false"




ExpandableRows="True" ResizableColumns="True" OnRowCommand="QFDataGrid_RowCommand"




 


OnRowDeleting="QFDataGrid_RowDeleting" OnRowDataBound="QFDataGrid_RowDataBound"


>




<Columns


>




<asp:BoundField DataField="FEETYPE"




HeaderText="FEE Type"


>




</asp:BoundField


>




 


<asp:TemplateField HeaderText="Fee Currency"


>




<itemtemplate


>




<SalesLogix:Currency runat="server" ID="QFDataGridcol2" DisplayMode="AsControl" ExchangeRateType="BaseRate" Text='<%# Bind("FEECURRENCY") %>' CssClass=""


/>




</itemtemplate></asp:TemplateField


>




 


<asp:ButtonField CommandName="Delete"




Text="Delete"


>




</asp:ButtonField


>




</Columns


>




</SalesLogix:SlxGridView


>





 I should give users a facility to directly Edit the different type of  Fees in the datagrid from 0 to what ever value and click on ok so that it should reflect on database.


But the Problem i am facing is i am unable to get the cell value for each row.


 


Please Suggest Raul!


 


Thanks,


mark



 






QFDataGrid.DataSource = dr;


QFDataGrid.DataBind();


  


 Here is my code behind for datagrid


  



[Reply][Quote]
Raul A. Chavez
Posts: 1300
Top 10 forum poster: 1300 posts
 
Re: SlxGridView object always saying it has no rows? (7.5.2 Web)Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 30 Jun 11 9:47 AM
fiogf49gjkf0d

On your SQL Statement, add your FEEID column:


e.g.  strsql1.Append("SELECT ADMINFEESID, FEETYPE,FEECURRENCY from sysdba.adminfees where opportunityid = '" + acc1.Id + "'");


 


On your Grid Definition, add the ID column as a DataKey:


<SalesLogix:SlxGridView runat="server" ID="QFDataGrid" GridLines="None" DataKeys="ADMINFEESID" .....


 


Then when you are trying to get the Value for a Given Row, you would get the DataKey value:


string feeID = QFDataGrid.DataKeys[0][idxRow].ToString();   //Not sure if the Indexes are backwards. 0 means first column, and since we only have one column defined on the DataKeys we use 0 for it


From there you could check your DataSource (if it is still populated) and get the record you are looking for, or just query the DB for the ID you receive...

[Reply][Quote]
mark
Posts: 70
 
Re: SlxGridView object always saying it has no rows? (7.5.2 Web)Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 30 Jun 11 10:02 AM
fiogf49gjkf0d

Hi Raul,


But my intention is, in my datagrid currecny column is editable column. So users will fill the data for each feetype.


I have a drop down in front of this datagrid where i will add a fee type to the Adminfee table with the Zero As Currency. So now users will add differnt type of admin fess from drop down in to the admin table for that opportunity. Once they add three or four types, they will change the data for all four types at a time. So for this purpose i want the value not in the table for a particular fee type but the value in the datagrid. So please Suggest.


Thanks,


mark


 

[Reply][Quote]
 Page 1 of 1 
  You can subscribe to receive a daily forum digest in your user profile. View the site code of conduct for posting guidelines.

   Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2025 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 6/28/2025 5:28:10 PM