User Profile & Activity

Jim Dresser Member
Page
of 2
Posted: June 29, 2012 9:41 AM
I really want to be able to modify the symbols that are displayed in the 'Insert Symbols' dropdown - I like the way that it looks and functions. Are you sure that it's not possible to modify the items in this dropdown?

Assuming that I can't modify the items in your dropdown, I've tried to attack this by adding a custom pane like your sample: TaskPane_CustomPane.aspx. Except instead of displaying Emoticons I'd display images of the special symbols that I need. Then, when the user clicks one of my symbol gifs, javascript would insert the HTML character codes that I need (for example, a 'Greater Than or Equal' symbol is '& g e ;' (I added spaces so that you could see the HTML that I actually want to insert). Most of this is working, here's what's not:

In your sample, the javascript does a 'rte.InsertImage(el.src);' to insert the image into the editor. I need to insert text. I found the 'SetValue' function rte.SetValue("≥"); but this erases any data that is in the editor, then it inserts the characters that I need it to.

So, I need a javascript function to just insert text. I tried rte.InsertValue("≥");   but 'InsertValue()' doesn't exist.

How can I insert text into the editor using javaScript ?
Thanks,
Jim
Posted: December 8, 2011 7:58 AM
Thanks for your response Handy, but I disagree with your conclusion - I still believe it's a bug. The issue also happens if you bind the WebGrid to a plain old SQLDataSource instead of the ISDataSource.

If you read Microsoft's documentation http://msdn.microsoft.com/en-us/library/59bfya48.aspx it says "By adding filtering to a SqlDataSource control, you can change what data is made available by the SqlDataSource after a query has been run, without returning to the database."

Every other bound control (Gridviews, Dropdowns....) behave this way - ie, changing the data that is sent to the bound control. Your WebGrid does not.

Now, I had to go down this path because of all the problems that I've run into trying to get the WebGrid to Filter and Sort programatically (either by javascript or code behind).

Some of our users can't figure out how to use the FilterBar, so I wanted to add buttons to the form which would have pre-defined filters and sorts.
I started with the sample on this page http://www.intersoftpt.com/Support/WebGrid/KB/Filter-a-Column-Using-HTML-Button-in-WebGrid/ which hooks some javascript up to a button, to add and remove filtering from the WebGrid. This works, but only in very simple conditions. ie, if you click the 'add filter' button, the WebGrid does filter - great. Now, show the filterbar, manually add another filter, then click 'Remove Filter'. 'Remove Filter' does not remove the 2 filters that are now being used by the WebGrid. My application may have 3, 4 or 5 filters applied at any time, so trying to keep track of how many filters to remove does not seem easy to do. There does not seem to be a "grid.RootTable.FilteredColumns.Remove(All)" function.

And I never got sorting working at all (using javaScript).  If you have a sample that shows how to add and remove sort order using javascript, it would be great.   So, being a good programmer, I thought that if I changed the dataSource, the WebGrid would just show what the datasource was sending it.  But your WebGrid does not behave this way.

Any other ideas?
Thanks,
Jim
Posted: November 4, 2011 4:14 PM

Thank you Hendrik, that fixed the issue.

 

Best,

Jim

Posted: November 3, 2011 7:53 AM

Thanks Hendrick,

 But I am setting the child page using javascript.  But that does not cause the child page to go through it's life-cycle EVERY TIME the same child page is re-opened.

 

On my parent page, I've got this javascript code which sets a querystring parameter based on a selection in a list, then opens the dialog:

  <script language="javascript" type="text/javascript">
    function WebButton1_OnClientClick(controlId, parameter) {
      var WebButton1 = ISGetObject(controlId);
      var WebDialogBox1 = ISGetObject("WebDialogBox1");
      // ToDo - Grab the value of a selected item in a listbox
      // until then, just hardcode
      var myIDValue = 1;
      WebDialogBox1.ContentURL = "Enums_Edit.aspx?myValue=" + myIDValue;
      WebDialogBox1.ShowDialog();
      return true;
    }

You can see how I'm calling a child page, and supplying it a querystring parameter.

Here's the whole code for the child page:
The .aspx page, just a button and a label inside an Update panel:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Enums_Edit.aspx.cs" Inherits="MasterController2012.Utilities.Enums_Edit" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
  <title></title>
</head>
<body>
  <form id="form1" runat="server">
  <asp:ScriptManager ID="ScriptManager1" runat="server">
  </asp:ScriptManager>
  <div>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
      <ContentTemplate>
        <asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
        <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
      </ContentTemplate>
    </asp:UpdatePanel>
  </div>
  </form>
</body>
</html>

And the .cs:  (set the label to some devault value in Page_Load, and when the user clicks the button, update the label to show the time on the server)

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace MasterController2012.Utilities
{
  public partial class Enums_Edit : System.Web.UI.Page
  {
    protected void Page_Load(object sender, EventArgs e)
    {
      if (!Page.IsPostBack)
      {
        Label1.Text = "set in page_Load";
      }
    }

    protected void Button1_Click(object sender, EventArgs e)
    {
      Label1.Text = System.DateTime.Now.ToLongTimeString();
    }
  }
}

At this point, I'm not using the querysting parameter, so forget about that.

The point is, when the child page loads, it sets the label text to "set in page_Load".  If you click the button, the server's time get put into the label.

This works great the FIRST TIME the child page is loaded. 

But, close the dialog, then open it again.  The page_Load does not fire - the child page will show the time that was in the label, when the dialog was closed.  We just re-opened the dialog, I want the label to show 'set in page_Load' every time the dialog is re-opened.

 

Re-opening the same child page does not cause the page to go through it's lifecycle.

I'm sure that you can see where I'm going with this example - The user will select an item from a list of items that is displayed on the parent page.  Then, they pop-up a dialog box which will allow them to edit the item.  But to do this, the child page has to go through it's lifecycle every time the page (dialog box) is opened.  This is necessary so that I can load the child page with the default values for the selected list item each time the dialog is opened.

Thanks,

Looking forward to your solution,
Jim

 

All times are GMT -5. The time now is 5:44 PM.
Previous Next