i am having a master page with a webpartzone inside the webpartzone i am having a detailsview now i want to bind the data to the detailsview from one of the content form i tried but it is not working any ideas
my code is
Dim myMaster As MasterPage = DirectCast(Me.Master, MasterPage)
Dim webpt As WebPartZone = DirectCast(myMaster.FindControl("WebPartZone1"), WebPartZone)
If Not IsNothing(webpt) Then
Dim dv As DetailsView = CType(myMaster.FindControl("dvapqp"), DetailsView)
dv.DataSource = ds.Tables(0)
dv.DataBind()
End If
finally i will answer my own question :-) i used a user control to display inside webparts and accessed it i explained it in my blog post
Related
on Vaadin 7 I have the working code :
private void gridAttachmentsClickItemEventAction(ItemClickEvent event) {
// blablabla some code to get the data from the repository
byte[] data = bibocoAttachmentResponseEntity.getBody().getContent();
StreamResource.StreamSource source = convertByteArrayToStreamResource(data);
String filename = "c:\\droppdf\\"
+"temp"+bibocoAttachmentResponseEntity.getBody().getFileName()+LocalDate.now().toString();
StreamResource resource = new StreamResource(source, filename);
resource.setMIMEType("application/pdf");
resource.getStream().setParameter("Content-Disposition", "attachment; filename=" + filename);
BrowserWindowOpener opener = new BrowserWindowOpener(resource);
opener.extend(btnAttachmentPreview);
}
When I click on a grid row, the data is collected from that grid
and code following on it gets the data byte[] from a repository by calling a service.
Afterwards, when the user clicks on btnAttachmentPreview a new browser tab opens
and shows the pdf (that's what's in the data byte[])
This works fine the first time, but when I select a new row in the grid,
the problem is that the second call does not set the listener to the button right.
It show the first data byte[] again in a new tab, not the current data ...
The method is accessed, the correct data[] has been loaded in the array the second time, I checked.
I believe the listener on the btnAttachmentPreview attached due the code
opener.extend(btnAttachmentPreview);
should be binned (empty'ed or nulled) first. But I have no reference to it as for as I can tell.
Problem is that I don't want to destroy the btnAttachmentPreview object.
(The btnAttachmentPreview is a global variable and is set to a layout that I may not change. I know, not nice, but it's a ancient product)
When I close the browser and restart and clicking another row, the right data byte[] is showed.
Anyone a clue ?
Any help appreciated
You can remove an extension using its remove() method, i.e. opener.remove();.
If you cannot easily structure your code to store a reference to the old opener so that you have it available when you want to add a new one, then you can use btnAttachmentPreview.getExtensions() to get a collection of all current extensions and then from that you can find the appropriate extension (if any) and call remove() on it.
I have a custom section, with a custom tree.
I'm having a bit of trouble understanding how you set the correct behavior when:
You click a node in your tree to edit it.
You click a menu item on a node like "Create"
In my solution I'm using the same view to edit and create a record.
In my tree this is how a node is generated.
var routeToView = "rewards/rewardsTree/editcampaign/campaign-" + campaign.Id.ToString();
var campaignNode = CreateTreeNode("campaign-" + campaign.Id.ToString(), id.Split('-')[1], queryStrings, campaign.CampaignName, "icon-folder color-yellow", true, routeToView);
This is producing the route I want: (the name of my html file is editcampaign.html) and it is also passing "campaign-6"
/umbraco#/rewards/rewardsTree/editcampaign/campaign-6
When a user clicks the create 'menu Item' on the node - I want to send them to the same URL but just with a diffrent Id for example:
umbraco#/rewards/rewardsTree/editcampaign/brand-1
and I don't want it to pop up out of the side
This is what I have tried so far:
//This finds the view, but it comes up in a dialog also how do I pass the Id (brand-1)
MenuItem mi = new MenuItem("editcampaign", "Create Campaign");
menuItemCollection.Items.Add(mi);
//Also Tried this finds puts a whole another umbraco UI inside a dialog
mi.LaunchDialogView("#rewards/rewardsTree/editcampaign/brand-1", "TITLE GOES HERE");
Can anyone point me to the fullest documentation for Menu's trees and navigation around the back office in general?
I believe there is an option to set view path on the "Create" menu item, which makes it open normally? Also, wouldn't it make more sense to have your path like /view/path/here/id ? Then when you create a new item just send 0 as id. Umbrangular on Github is a project with great examples of custom sections and views.
EDIT: Here's an example
protected override MenuItemCollection GetMenuForNode(string id, FormDataCollection queryStrings)
{
var menu = new MenuItemCollection();
MenuItem createCategory = new MenuItem("createcategory", "Create Category");
createCategory.AdditionalData.Add("ParentCategoryId", id);
createCategory.NavigateToRoute("/path/to/view/category/0");
createCategory.Icon = "add";
menu.Items.Add(createCategory);
return menu;
}
I have a dilemma.
I would like to in my form if the data that are bind (object) added to the form, depending on whether the image exists or not, the item is shown on the form or not.
I solved it like this, but I do not know if this is correct.
$id = (int) $this->params()->fromRoute('id', 0);
$coupon = $this->getEntityManager()->find('Application\Entity\Coupon', $id);
$forms = $this->getServiceLocator()->get('FormElementManager');
$form = $forms->get('CouponForm');
$form->bind($coupon);
$form->setBindOnValidate(false);
$form->get('dateStart')->setValue($coupon->getDateStart()->format('Y-m-d'));
$form->get('dateEnd')->setValue($coupon->getDateEnd()->format('Y-m-d'));
if($coupon->getImageUrl()) {
$form->get('image')->setAttribute('src', $coupon->getImageUrl());
}else {
$form->remove('image');
}
Can it be nicer to solve?
In the event you're looking to change the display of the form itself, the logic for rendering/not rendering the coupon should most likely live in a View Helper.
This keeps the rendering free from the controller and maintains a nice separation of concerns.
I have a webpage with multiple jqgrids each with inline editing enabled, "action" column (edit icons) enabled and pager disabled. I need to handle the delete event for each row so that I can process the delete without reloading server-side data. I've looked at the approach mentioned in jqGrid Delete a Row and it's very helpful except I have two questions that are stumping me -
Are there more details around the rp_ge parameter in the delOptions.onClickSubmit event?
My column has the delOptions set as this -
delOptions: {onclickSubmit: function(rp_ge, rowid) {return onRowDelete(rp_ge,rowid);}},processing:true }},
Is there a way to get the grid id from within that event? I'd like to have a generic function that I can use to handle delete events from all the grids on the page. The rp_ge parameter has a gbox which sometimes contains the grid id appended? But I have no idea what it is since i'm not able to figure out when it's populated, when it's not.
function onRowDelete(rp_ge, rowid) {
//hardcoded grid id.. don't like it.
var gridid = '#Grid_X';
//what is this gbox?? can i get grid id predictable from it?
//var gridid = rp_ge.gbox.replace("#gbox_", "");
var grid = $('#Grid_X');
rp_ge.processing = true;
var result = grid.delRowData(rowid);
if (result) {
$("#delmod" + grid[0].id).hide();
}
return true;
}
In the jqGrid Delete a Row approach, the code $("#delmod"+grid[0].id).hide(); is hiding the popup delete confirmation dialog manually. What I noticed is that when the dialog pops-up, jqgrid de-emphasizes the background page (makes it light greyish). But after the popup is manually closed (hidden actually?), the background remains de-emphasized. So it looks like the page doesn't have focus (or even disabled). Any way this can be fixed? This can also be seen on the demo that Oleg wrote.
Any help would be appreciated.
(PS - I would've commented on the same post but I don't have enough points to comment on someone else's answer yet.)
In answer to your second point.
Several examples by Oleg such as this one have the following modification.
$("#delmod" + grid[0].id).hide();
is replaced with
$.jgrid.hideModal(
"#delmod"+grid_id,
{gb:"#gbox_"+grid_id,jqm:rp_ge.jqModal,onClose:rp_ge.onClose}
);
This will return focus after the delete operation.
I have a control of id "C_44" in content page. I am stuck on how to find the rendered control id in master page using javascript
Thanks
Since id's have to be unique, you should be able to document.getElementById('C_44');
However, if you 'insist' on searching through the children of the master control, try this:
var master = document.getElementById('masterId');
var children= master.childNodes;
for(var i = 0; i < children.length; i++)
{
if(children.item(i).id == 'C_44')
{
//use child
}
}
You can do this in two ways.
If you are using Asp.net 4, then you can set the clientidmode to static on the control. Then you would be able to access it with the same id.
The other approach is to make use of control.ClientId property. You can inject the clientid of the control as a javascript variable and use that variable in javascript.
Hope this helps.