I am adding a dynamic grid to a view port on click of a button the data in the store is from an ajax proxy , I am using the same code as in http://examples.ext.net/#/GridPanel/Saving_Variations/HttpHandler/
but the difference is I am adding it in behind code .
First problem is all the icon are not showing it is saying that it is cannot be found.
Second problem is that I am getting the headers and the buttons and they are functioning properly but there is no data displayed in the grid ...
Please help I have tried every thing I know here .
Firstly the icons may need to be registered in order for them to be rendered. Use the following code. This is especially true when loading icons dynamically.
protected void Page_Load(object sender, EventArgs e)
{
if(!X.IsAjaxRequest)
{
this.resourceManager.RegisterIcon(Icon.Lorry);
}
}
Secondly, if you are seeing blank rows in the grid it would suggest the data is being loaded but that you have a case mis-match between your ModelField and Column DataIndex value(s). DataIndex values are CASE SENSITIVE.
I hope this helps.
Thanks,
Gav
Related
I want to change the update mode like here. This is my code:
this.datePicker.On<iOS>().SetUpdateMode(UpdateMode.WhenFinished);
The first part is marked as wrong this.datePicker.On<iOS>() and it is referencing an object in the xaml. On other places the same code is working fine. Don't know what's wrong here. The error message is:
Returns the platform-specific instance of this DatePicker, on which a platform-specific method may be called.
'IPlatformElementConfiguration' does not contain a definition for 'SetUpdateMode' and the best extension method overload 'Picker.SetUpdateMode(IPlatformElementConfiguration, UpdateMode)' requires a receiver of type 'IPlatformElementConfiguration'.
Any suggestion?
Edit:
It seems that the desired behavior (updateMode) is only available for Picker and not DatePicker. See here or here. Is there a way to enable the feature also for Datepicker? How?
Using Xamarin Forms 4.6 here. Inside your custom renderer use this code:
protected override void OnElementChanged(ElementChangedEventArgs<DatePicker> e)
{
base.OnElementChanged(e);
if (e.NewElement != null && Control != null)
{
...
Element.On<Xamarin.Forms.PlatformConfiguration.iOS>().SetUpdateMode(UpdateMode.WhenFinished);
...
}
}
Sadly, UpdateMode is not available for Date picker.
And the workaround i found,is to create a custom calendar(which i did).Custom calendar looks tough to create,but is quite simple to implement(of basic functionalities) .
With only 1 month of experience in xamarin, i've created it.
You can check out the complete code here:
https://medium.com/#bhavyajoshi2793/custom-calendar-in-xamarin-for-android-ios-windows-578f1136daec?source=friends_link&sk=9b1c97e0021da2e48ec84b5b6d4ff8e4
I am using devexpress for windows application. I am having a devxgrid which populates the data and at the last column, I have a hyperlink button named cancel. When I click the cancel button it will do some functionalities that is working great. After that the corresponding cancel button should be disabled. How to make it disabled? Any help is greatly appreciated.
There are two ways to implement this task:
Create two ButtonEdit repository items. One with the enabled button and another with the disabled button. Then handle the GridView.CustomRowCellEdit event and pass the necessary repository item to the e.RepositoryItem parameter according to a specific condition. Please see the Assigning Editors to Individual Cells help topic for additional information.
If the button editor has several buttons and their Enabled state must be changed dynamically, you can implement this functionality by handling the GridView.CustomDrawCell event as shown in the following DevExpress Forum thread:
How to display disabled buttons for particular cells within a ButtonEdit column
.
But you should follow the first approach, In case of hyperlinkEdit., for your implementation logic add a custom column with bool values, that will give you condition that whether you will show enabled or disabled hyperlinkEdit repository edit.
If you just want to set this readonly then you do in following way:
you can make the editor read only by handling CustomRowCellEdit:
private void gridView1_CustomRowCellEdit(object sender, CustomRowCellEditEventArgs e)
{
if(code goes here)
e.RepositoryItem.ReadOnly = true;
}
you can also prevent the editor from being show by handling ShowingEditor:
private void gridView1_ShowingEditor(object sender, CancelEventArgs e)
{
if (code goes here)
e.Cancel = true;
}
Hope this help you to solve your task..
I am using treeview in my asp.net application which have 2000 nodes in it. The treeview takes 40 sec to load on IE7,8 while same page takes 1/10th time on Firefox and chrome. Is there any solution to this problem. Tried searching for this but found only unanswered questions. If this is a limitation of IE 7,8 then what is the reason for it. Is it because of the rendering engine. Is there any solution to the problem ? I mean i tried using the jquery treeview but again it hangs the IE and alert popups up for slow script.
Please help.
Have you tried this jQuery plugin? http://www.jstree.com/
It supports AJAX loading, which is great for a 2000 node tree.
When you open the rendered html generated from the tree view, you will find that the control generate a hell of html table, tr and td which I think is taking a very long time to be rendered on IE so I suggest that you create a new custom web control that inhertis from the treeview control and update the "Render Method" to write Div's instead of HTML and this will require a professional developer and HTML designer to do this.
I think you can after that share this new control with the community and we can enhance on it with you to get rid of this dummy asp.net gridview.
There must be something else going on. I did some performance testing on TreeView and was able to render a complex tree structure containing 5000 nodes in far less time then 40 seconds. A 2000 node complex tree rendered in about 3 seconds in IE8. If you can provide some more details about your tree maybe I can provide more assistance.
I've read that the amount of rendered HTML is one of the biggest factors when it comes to rendering time on a big tree. Even simple things such as reducing the length of a URL string by shortening a page name (if your nodes link directly to pages) or replacing CSS classes with more advanced style sheet usage techniques can make it considerably faster.
Below is my code for generating a random complex tree of _nodeCount size:
ASPX Page has a TreeView named tv:
<asp:TreeView ID="tv" runat="server"></asp:TreeView>
Code Behind looks like the following:
private Random _rand = new Random();
private int _nodeCount = 2000;
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
//create a big tree
var itemCount = 0;
while (itemCount < _nodeCount)
{
//create a parent item
var n = new TreeNode("Node " + itemCount.ToString(), itemCount.ToString());
itemCount++;
tv.Nodes.Add(n);
CreateSubItem(n, ref itemCount);
}
}
}
protected void CreateSubItem(TreeNode parent, ref int itemCount)
{
//chance that we won't create a sub item
if (_rand.Next(2) == 1 || itemCount > _nodeCount)
{
return;
}
var n = new TreeNode("Child Node " + itemCount.ToString(), itemCount.ToString());
itemCount++;
parent.ChildNodes.Add(n);
CreateSubItem(n, ref itemCount);
CreateSubItem(parent, ref itemCount);
}
Update 7/20
Perhaps you could take the logic in your javascript for setting icons and move it into .NET code, this should greatly reduce the page load time. This page, http://weblogs.asp.net/dannychen/archive/2006/01/25/436454.aspx, shows how to customize the rendering of a TreeNode; maybe it could be a good starting place for you.
It is always good to use AJAX in your application and load the treeview dynamically via AJAX. Here is a link...
http://www.codeproject.com/KB/ajax/selfloadelement.aspx
Setting the attribute HoverNodeStyle-CssClass="nh" makes the rendering of the TreeView slow in IE9. I removed the attribute and the performance restored.
It is known that the ListView control can't display both an EmptyDataTemplate and a InsertItemTemplate at the same time.
For my design style I need to be able to show both. I want to be able to show that no data exist and at the same time show a form to add new data.
I've already implemented various solutions, such as putting a PlaceHolder in my LayoutTemplate and then manually showing or hiding this PlaceHolder in the code-behind, depending on if there is data or not.
However, I would like a control that has this built-in capability in order to keep my code-behind light.
I believe there are only two ways to achieve what I want:
First way (preferred) is to write that custom control myself. I was thinking of deriving from ListView and overriding the function responsible for disabling the EmptyDataTemplate, but I have no experience with custom controls. And I'm not even sure it will work in the end.
Second way is to use a custom control found or purchased somewhere. I have not been able to find such control that has the same base capabilities as the ListView.
Has anybody any idea how to solve #1 and maybe #2?
Thank you.
Here is what I ended up doing:
public class MyListView : ListView
{
protected override int CreateChildControls(IEnumerable dataSource, bool dataBinding)
{
int itemCount = base.CreateChildControls(dataSource, dataBinding);
if (this.InsertItemPosition != InsertItemPosition.None && itemCount == 0)
{
CreateEmptyDataItem();
}
return itemCount;
}
}
Works great!
I would go for your option 1: Create a custom control
Because you haven't specified a programming language I made one in VB.NET:
Public Class CustomListView
Inherits ListView
Public Sub CheckEmptyData() Handles Me.PreRender
If Me.Items.Count = 0 Then
Dim label As New Label
label.Text = "No data found <br/>"
Me.Controls.AddAt(0, label)
End If
End Sub
End Class
Just tested it and works perfectly, it can just replace an existing ListView.
As you can see it checks if there is any data and if not it inserts a label with the text "No data found". I haven't found an easy way to use the EmptyDataTemplate for this, that would be a better option but this might already work for you.
Another option is to hide the InsertItem (InsertItemPosition.None) if there is no data, and add a Button "Insert" to the EmptyDataTemplate that enables the InsertItemTemplate and therefore hides the EmptyDataTemplate.
I don't understand much of your requirement without a screen shot of what you are actually trying to achieve. Anyway, you may be able to achieve this interface with a combination of ListView+FormView or ListView+ a User Control. If you can provide any more info I may help further.
Im implementing custrom delete by adding to my ASPxGridView GridViewColumnCustomButton.
Then on my GridView I handle ClientSideEvent
<ClientSideEvents CustomButtonClick="function(s, e) { customButton_OnClick(s, e); }" />
JS:
function customButton_OnClick(s, e) {
if (e.buttonID == "customButtonId") {
e.processOnServer = confirm("Really want to delete?");
}
}
Ive also added to my grid:
OnCustomButtonCallback="GvMyGridViews_OnCustomCallback"
now on the server side I user linq to delete specified row and then submit changes to my DataContext and then DataBind() on my grid.
Problem is that sometimes standard ASPxGridView loading panel is shown for about 1 second ant then my row dissapears so it behaves properly but sometimes loading panel stops mooving. and I need to move mouse over my grid or click button so that my Grid is updated(row dissapears).
Have You got any Idea where the problem is ?
Thanks for help
It it hard to answer your question. Please try to determine if the row was actually deleted from the DB when you call the grid's DataBind method. Also, I suspect that the ASPxGridView is bound to a LinqDataSource object. If so, I suggest that you log which data it returns and check if a row deleted is in the list. It is possible since this component can cache data and return a non valid recordset. To determine which data is returned by the LinqDataSource, you may use the code from
http://forums.asp.net/p/1583916/3998100.aspx
Make sure that after you delete the record at the end of your custombuttoncallback handler that you SET THE DATASOURCE then rebind the grid. If you just call DataBind() without setting the datasource it will not work properly. Ie.
aspxGrid.DataSource = updatedDataSourceAfterTheDelete;
aspxGrid.DataBind();