Radgrid inside editform settings - c#-4.0

I have a radgrid inside the edit form.I am binding the radgrid on the itemdatabound.
int id= Convert.ToInt32(editForm.GetDataKeyValue("ID").ToString());
RadGrid SummaryGrid = (RadGrid)item.FindControl("SummaryGrid");
SummaryGrid.DataSource = spObj.Sp_GetProjectDetails(id);
SummaryGrid.Visible = true;
SummaryGrid.Enabled = true;
SummaryGrid.DataBind();
The problem is I am able to edit only the last row in the grid.I m able to see the data binding to the inner grid for the last row.For all other rows I get the below error.
"There was a problem extracting DataKeyValues from the DataSource. Please ensure that DataKeyNames are specified correctly and all fields specified exist in the DataSource."
My grid inside edit:
<telerik:RadGrid ID="SummaryGrid" runat="server" AllowPaging="True" PageSize="50" AutoGenerateColumns="true" Visible="true"
AllowMultiRowSelection="true" AllowSorting="true" Skin="Hay" Width ="500px" >
<MasterTableView DataKeyNames="ProjectID" CommandItemDisplay="Top" TableLayout="Fixed" Caption ="Position-Specific Network + Activity Code Totals" Font-Bold="true" Font-Size="Small" Font-Names ="Ericsson Capital TT" >
<PagerStyle Mode="NumericPages" Position="Top"></PagerStyle>
<CommandItemSettings ShowAddNewRecordButton="false"/>
</MasterTableView></telerik:RadGrid>
</telerik:RadAjaxPanel>
This issue is blocking the development.can some one suggest any help on this?Any help/ideas highly appreciated.
Thanks

int id= Convert.ToInt32(editForm.GetDataKeyValue("ID").ToString());
This should be using ProjectID instead of ID. ID is not a data key that you've specified in your MasterTableView.

Related

Excel Custom UI Addin Resets Quick Access Toolbar

I recently created an AddIn to make the lives of my co-workers easier, and to make it as easy as possible for them I made a custom UI to add a tab and buttons for the macros. It works great and everyone is mostly happy. A problem has cropped up on some of their computers where the quick access tool bar gets reset every time they open Excel. Mine also reset the first time, but it's held on to changes I've made since. Other's gets reset every time they open it and I can't figure out why. I built my customUI from scratch and did not use any third party software to do it.
There isn't any code within the AddIn that affects the UI, the only code I put in was a Case statement to run specific macros for specific buttons. Below is my custom UI xml file. Anyone have any ideas why the quick access toolbar keeps resetting?
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">
<ribbon>
<tabs>
<tab id = "CRC" label = "CRC Macros" insertAfterMso = "TabHome">
<group id = "MPS" label = "Schedule">
<button id = "KTC_button" label = "KTC MPS" image = "ktc_icon" size = "large" onAction = "ProcessRibbon"/>
<button id = "KTS_button" label = "KTS MPS" image = "kts_icon" size = "large" onAction = "ProcessRibbon"/>
<button id = "KTV_button" label = "KTV MPS" image = "ktv_icon" size = "large" onAction = "ProcessRibbon"/>
<button id = "split_button" label = "Split Schedule" image = "split_icon" size = "large" onAction = "ProcessRibbon"/>
</group>
<group id = "CTB" label = "Shortage Reports">
<button id = "QD_button" label = "Quick CTB" image = "qd_icon" size = "large" onAction = "ProcessRibbon"/>
<button id = "PL_button" label = "Product Line or CSV" image = "pl_icon" size = "large" onAction = "ProcessRibbon"/>
</group>
<group id = "OTH" label = "Other">
<button id = "STG_button" label = "Shipments-To-Go" image = "stg_icon" size = "large" onAction = "ProcessRibbon"/>
<button id = "peg_button" label = "Format Pegged" image = "peg_icon" size = "large" onAction = "ProcessRibbon"/>
<button id = "MRP_button" label = "MRP Summary" image = "MRP_icon" size = "large" onAction = "ProcessRibbon"/>
<button id = "MPS_Sum_button" label = "MPS Summary" image = "MPS_Sum_icon" size = "large" onAction = "ProcessRibbon"/>
</group>
</tab>
</tabs>
</ribbon>
</customUI>
Your ribbon XML markup looks good. It cannot be related to resetting the QAT in Office applications (Excel in your case) from the first sight.
First of all, you need to check out the list of Office add-ins. There can be any conflicts between extensions and your customizations.
Second, make sure there are no UI errors in Excel. By default, if an add-in (or any other kind of ribbon customizations) attempts to manipulate the Microsoft Office user interface (UI) and fails, no error message is displayed. However, you can configure Microsoft Office applications to display messages for errors that relate to the UI. You can use these messages to help determine why a custom ribbon does not appear, or why a ribbon appears but no controls appear. See How to: Show Add-in user interface errors for more information.
Third, it is not clear what your callbacks do. But ribbon is a static thing from its birth, so QAT can't be customized at runtime without loading a custom ribbon XML. So, only users or add-ins could do resets.

Redirection Link not Updating to Fetch New Information

I added a redirection link to the reference numbers in a grid that link back to receipts. I followed the instructions given in T200 to perform the task, except
I made the page that opens a popup instead of a new tab. It works for the first reference number I click, but after that it doesn't change the record. Instead the popup displays the record for the first reference number I clicked. Here is my code:
protected void RefNbrReceipt()
{
INRegister row = Receipts.Current;
INReceiptEntry graph = PXGraph.CreateInstance<INReceiptEntry>();
graph.receipt.Current = graph.receipt.Search<INRegister.refNbr>(row.RefNbr);
if (graph.receipt.Current != null)
{
throw new PXPopupRedirectException(graph, "Receipt Details");
}
}
I checked and made sure that the row updates to the selected value (I do have SyncPosition = true on the grid) as well as after the Search that graph.receipt.Current.RefNbr = row.RefNbr. All of the objects in the code when debugging and stepping through it are set to the correct values they should be. Even though these values are showing correctly, when the popup appears, it still has the incorrect record (the first record fetched).
Are you sure Current is set correctly?
If not make sure you use DependOnGrid:
<px:PXDSCallbackCommand Name="RefNbrReceipt" Visible="False" DependOnGrid="grid" CommitChanges="True" /></CallbackCommands>
You can also try setting CurrentDocument and Current cache record before opening the graph:
INRegister inRegister = graph.receipt.Search<INRegister.refNbr>(row.RefNbr);
graph.receipt.CurrentDocument.Current = inRegister;
graph.Caches[typeof(INRegister)].Current = inRegister;
In some scenario with popup windows, you need to issue a refresh command with AutoCallBack-Command and AutoCallBack-Target attributes, you can do that with grid and form containers:
<px:PXSmartPanel ID="pnlActivityLog" runat="server" Width="800px" Height="400px" Style="z-index: 108;" Caption="Activity log" CaptionVisible="True"
Key="ActivityLogs" CommandSourceID="ds" CreateOnDemand="False" AutoCallBack-Command="Refresh" AutoCallBack-Target="gridActivityLog">
<px:PXGrid ID="gridActivityLog" runat="server" Height="200px" Width="100%" BatchUpdate="True" SkinID="Inquire" DataSourceID="ds">
</px:PXPanel>
</px:PXSmartPanel>
I had the same issue PXPopupRedirectException
To solve this I used PXRedirectRequiredException like this:
throw new PXRedirectRequiredException(graph, "Subcontract", true) { Mode = PXBaseRedirectException.WindowMode.NewWindow };
This opens up a new browser window and repaints the controls of the calling window.
This is necessary if you have child grids that are depending on the row you click - and if the use 'changes rows' by clicking directly on the link.

XPages ftsearch results for combobox fields

I created on my previous applications a simple FTsearch module, displaying the results inside a viewPanel1.
But, now in other app it gives me a headache. The search code from the view:
var tmpArray = new Array("");
var cTerms = 0;
if (sessionScope.searchFurnizor) {
tmpArray[cTerms++] = "(Field txt_particontractcv_1 = \"*" + sessionScope.searchFurnizor + "*\")";
}
if (sessionScope.searchStare) {
tmpArray[cTerms++] = "(Field txt_stadiucontrcv = \"*" + sessionScope.searchStare + "*\")";
}
qstring = tmpArray.join(" AND ").trim();
sessionScope.queryString = qstring;
return qstring
The txt_particontractcv_1 is a simple inputText and txt_stadiucontrcv is a checkbox:
<xp:checkBoxGroup id="checkBoxGroup1" value="#{Contr.txt_stadiucontrcv}" defaultValue="In derulare">
<xp:selectItem itemLabel="In derulare" itemValue="In derulare"
id="selectItem1">
</xp:selectItem>
<xp:selectItem itemLabel="Finalizat" itemValue="Finalizat"
id="selectItem2">
</xp:selectItem>
</xp:checkBoxGroup>
The button which submits the search is doing a partial refresh to viewPanel1. Still, it returns 0 results even there are documents respecting the filter criteria inside the search.
LATER EDIT: After deleting one by one fields from the FTsearch module, I think I found the issue: the problem is at the fields which are comboboxes ( my case ) in the document content but also inside the FTsearch modulo. The code for the combobox from the FTsearch:
<xp:checkBoxGroup id="checkBoxGroup1" value="#{sessionScope.searchStare}">
<xp:selectItem itemLabel="In derulare" itemValue="In derulare" id="selectItem1">
</xp:selectItem>
<xp:selectItem itemLabel="Finalizat" itemValue="Finalizat" id="selectItem2">
</xp:selectItem>
</xp:checkBoxGroup>
Also, I noticed that the inputField(s) must be inputText, I try with some comoboboxes as input fields, but not working.
Are you refreshing the view in the partialrefresh or a panel outside of the view?
because if you are refreshing the view you probably never update the search query. If so add an xp:panel or xp:div out side of the view and do the partial refresh on that.
Whenever a full text search is not working how you expect it to, my recommendation is always to print out the search string. Then try performing the search in a view in the Notes Client.
If it doesn't work in the view in the client, trying to resolve it in your XPage will not get it working. The Notes Client will tell you why, usually "Query is not understandable" and you can troubleshoot why using the buttons in the search bar in Notes, which tells you which fields are available and what data type the UNK table thinks they are.
If it does work, there's a problem somewhere in your XPage.
As ever, break it down to try to identify where the problem is - in this case the full text search functionality or the implementation of it in XPages.

How to get row id with Dojo dataGrid

I'm using dojo dataGrid, and i need to get the row id.
When i use the "rowIndex" event, i get the "id" of the row, but, if i sort the grid, the data keeps another value in the row "id".
Can someone tell me how to solve this problem ? Thanks
Do you need the row of the grid when selected? Why do you need the row id? Usually I find if I let dojo handle row and data sorting for me and just pull in the selected item when I need it I'm better off.
e.g.
function onSelectedGridParm(nRow){
var objGridParm = dijit.byId("gridParm");
var item = objGridParm.getItem(nRow);
// single select - use an array here for multi select
// and remove in onDeselect
_selectedVariable = item;
fnEnableButton( "VariableEdit" );
fnEnableButton( "VariableDelete" );
}
....
<div id="gridParm" dojoType="dojox.grid.DataGrid"
style="width: 100%; height: 550px;"
structure="layoutVariables"
selectionMode="single"
noDataMessage="No Data Found with current filters"
onSelected="onSelectedGridParm"
onDeselected="onDeselectedGridParm"
rowsPerPage="50"
>
</div>

SharePoint 2010 Web controls - LookupField value not being set on postback

I've created a custom edit form as a simple aspx page in VS2010 (inherits from LayoutsPageBase) which uses the SharePoint Web controls LookupField control to display a drop down list of values from a custom type
The form displays correctly with the drop down box containing the expected range of values
The ControlMode is set to the same as the FormContext (though I have tried explicitly setting this to Edit)
But on the postback the value of the dropdown list is not set - the selected item index is set to -1
How can I correctly use the LookupField control to capture a selected value from the user?
Could it be because I'm adding the controls declaritivly in the aspx and then setting the list id etc from the SPContext in the page load event? - see code snippet below (not the prettiest but just trying to get it to work at this point):
from aspx:
<SharePoint:FileField ID="FileNameText" InputFieldLabel="Name" runat="server" ControlMode="Display"/><br />
<SharePoint:LookupField ID="FeedType" runat="server" />
<SharePoint:TextField ID="FeedStatus" runat="server" />
....
in the code behind page load:
if (!IsPostBack)
{
SPItem feedFileItem = SPContext.Current.Item;
FileNameText.ControlMode = SPContext.Current.FormContext.FormMode;
FileNameText.ListId = SPContext.Current.ListId;
FileNameText.ItemId = SPContext.Current.ItemId;
FileNameText.FieldName = "Name";
FeedType.ControlMode = SPControlMode.Edit;
FeedType.ListId = SPContext.Current.ListId;
FeedType.ItemId = SPContext.Current.ItemId;
FeedType.FieldName = "FeedType";
FeedStatus.ItemContext = SPContext.Current;
FeedStatus.RenderContext = SPContext.Current;
FeedStatus.ControlMode = SPControlMode.Edit;
FeedStatus.ListId = SPContext.Current.ListId;
FeedStatus.ItemId = SPContext.Current.ItemId;
FeedStatus.FieldName = "FeedStatus";
}
UPDATE
Ok I managed to get my form working by adding the controls in the code behind in the override of CreateChildControls - this is in line with the majority of the samples I've seen on the net.
But can someone explain why my approach didn't work and whether I can do this all in a declarative way in the aspx?
During postbacks selected values from lists are simply ignored if the list control isn't populated. So if you choose item 2 and the list items are null it will simply ignore the response parameter and not set the Value property. This is because ProcessPostData occurs prior to LoadData. Even if you were to remove the !IsPostBack on the LoadData method it still wouldn't work because ProcessPostData still occurs before LoadData and you didn't load the list prior to processing the postback.
A simple way to fix this is move your initialization code into the EnsureChildControls method of your Application page.
protected override void EnsureChildControls()
{
base.EnsureChildControls();
...
FeedType.ControlMode = SPControlMode.Edit;
FeedType.ListId = SPContext.Current.ListId;
FeedType.ItemId = SPContext.Current.ItemId;
FeedType.FieldName = "FeedType";
...
}

Resources