MonoX support board

Start the conversation, ask questions and share tips and solutions with fellow developers.

Non-registered users can only browse through our support boards. Please register now if you want to post your questions. It takes a second and it is completely free. Alternatively, you can log in without registration using your credentials at major sites such as Google, Microsoft Live, OpenId, Facebook, LinkedIn or Yahoo.

Problems with Random .NEt Controls.  (Mono Support )

Viewed 59750 time(s), 19 post(s) 6/30/2011 1:24:56 AMby shawndg
khorvat

khorvat

7/14/2011 3:30:19 PM
Are you sure that you don't get any other javascript errors ? Can you please check the CSS styles that are applied to the TreeView ? Maybe something is interfering with the TreeView CSS classes. 

Here is the simple MSDN article that may help you
http://msdn.microsoft.com/en-us/library/7a9swst5(v=vs.80).aspx
This content has not been rated yet. 
15993 Reputation 2214 Total posts
shawndg

shawndg

7/15/2011 2:14:29 PM
Yep..

I looked at it but not helping much..

Now i tired to drag the treeview panel into a update panel..

and Now I am getting is not a known element ?


Have you tried getting a treeview to work inside a Monox web part ?

This content has not been rated yet. 
1871 Reputation 252 Total posts
shawndg

shawndg

7/15/2011 7:46:49 PM
Ok..
I started implemented my own control..

I added a snippet of Javascript

<script language="JavaScript">
function TestMe()
{
var mytest = prompt('Enter a string','');

if ((mytest) && (mytest != ""))
{
document.forms[0].elements['TestValue'].value = mytest;
__doPostBack('TestMe', '');
}

}
</script>

And a little bit of ASP Markup..

<a href="javascript:TestMe();">Create Text file</a>
<asp:linkbutton id="TestMe" runat="server" onclick="TestMe_Click" />
<input type="hidden" runat="server" id="TestValue">

and then some code behind..

protected void TestMe_Click(object sender, EventArgs e)
{
string strTestMe = TestValue.Value;

}

Then ran it and clicked on my button and now inside my script I can see a error..

<script language="JavaScript">
function TestMe()
{
var mytest = prompt('Enter a string','');

if ((mytest) && (mytest != ""))
{
document.forms[0].elements['TestValue'].value = mytest; this line errors,
__doPostBack('TestMe', '');
}

}
</script>

SCRIPT5007: Unable to set value of the property 'value': object is null or undefined

Im thinking... since I am putting these controls inside of a webpart..

The ref is not correct.. document.forms[0] ... i tried 'form1' it
errors, and then instead i tried a array of forms[0] and it errors too.

Now Im not a javascript expert.. but I think the problem is with the controls and their call backs.

Im thinking.. the javascript is unable to find the form object.. because its nested inside a monox web control.
Any thoughts ?

This content has not been rated yet. 
1871 Reputation 252 Total posts
khorvat

khorvat

7/15/2011 9:29:35 PM
Hi,

I'll try to reproduce the issue with the TreeView and get back to you so we can sort that out. As for the "My own control issue" MonoX don't wrap form element it is placed on the top master page and code looks like this:

<%@ Master Language="C#" AutoEventWireup="true" Inherits="MonoSoftware.MonoX.MasterPages.Main" EnableTheming="true" Codebehind="Main.master.cs" %>
 
<!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" <asp:Literal runat="server" ID="ltlRootHtml" />>
<head runat="server">
    <title></title>  
</head>
<body style="height:100%">
    <form id="form1" runat="server" style="height: 100%">
        <asp:ScriptManager ID="AjaxScriptManager" runat="server">
        </asp:ScriptManager>
        ...
        <asp:ContentPlaceHolder ID="cp" runat="server">
        </asp:ContentPlaceHolder>
    </form>
</body>
</html>

So basically this is most common place to put the form tag. I think that in your case this is most probably the issue with javascript and browser compatibility. While I'm trying to reproduce the issue from TreeView can you please take a look at the jQuery javascript library (it is included in MonoX so you can just start using it) to overcome the browser compatibility issue.

jQuery references
http://www.jquery.com/

You can get to the form element in javascript by doing this
$("form")

or you can find element on the page 
- find all element of given tag
$('span')
- find element with given id
$('#IdOfTheElement')
- find all element with given css class
$('.css-class-name')

I hope this will get you started while I'm working on the TreeView.

Regards







This content has not been rated yet. 
15993 Reputation 2214 Total posts
shawndg

shawndg

7/19/2011 11:43:42 AM
Ok..

Well I managed to get a little closer..

I looked at Jquery and it looks useful although I have not played with it yet inside monox.

Now.. I did managed to find why my ref where not working..
I did not notice that my names where a little longer then i thought... they where combined.. webpartname_fieldname.. I found this out by using firefox debugger and digging into the gen source a little..

Once I figure this out I got rid of the java script errors. but the call backs still are not working with my custom script..
My next step is to check out Jquery and inside monox and see how that goes.

Have you had any luck with treeview ?
This content has not been rated yet. 
1871 Reputation 252 Total posts
khorvat

khorvat

7/19/2011 2:44:13 PM
Hi,

We are working on the TreeView issue and I think we will have a sample / reproduced issue tomorrow morning. Stay tuned

Regards

This content has not been rated yet. 
15993 Reputation 2214 Total posts
khorvat

khorvat

7/20/2011 2:28:07 PM
Hi,

we have tried to reproduce the issue but we couldn't, in our case TreeView renders perfectly and client side scrips for TreeView Node expand functionality are working as expected.

Please take a look at the attached code.

If your problem persists can you send us a screenshot of the TreeView and the Javascript debuger from the FireFox ?

Regards
This content has not been rated yet. 
15993 Reputation 2214 Total posts
shawndg

shawndg

7/21/2011 11:52:24 AM
I tried your example..

I get the following error when I click any item in your list.
It also does not look or act anything like a treeview,

SCRIPT5007: The value of the property 'GetViewState__AspNetTreeView' is null or undefined, not a Function object
ContentTemplatePage.aspx, line 62 character 1


All it does is list the items..
This content has not been rated yet. 
1871 Reputation 252 Total posts
khorvat

khorvat

7/21/2011 3:02:16 PM
Hi,

did you forgot to check "~\App_Browsers\CSSFriendlyAdapters.browser" file and comment or delete the following line (I think that this is causing the issue)

<adapter controlType="System.Web.UI.WebControls.TreeView" adapterType="CSSFriendly.TreeViewAdapter" />

Please get back to us with the results.

Regards
This content has not been rated yet. 
15993 Reputation 2214 Total posts
1 2