PDA

View Full Version : [CLOSED] PropertyGrid Values



t0ny
Oct 10, 2008, 11:23 AM
Hi there,

I have been playing with the PropertyGrid control and I wondered if I could perhaps use a dropdownlist or something for the selection method of a row as I want more than true or false...

I tried a combobox in the editor tags, but received some javascript errors...

Also, am I able to group the options in the property grid as I see there is a GroupingView option?

Thanks

Vladimir
Oct 10, 2008, 1:34 PM
Hi,

This is code shows how use Combo in PropertyGrid



<ext:PropertyGridParameter Name="version" Value="0.01" >
<Editor>
<ext:ComboBox runat="server" TriggerAction="All" Mode="Local">
<Items>
<ext:ListItem Text="0.01" />
<ext:ListItem Text="0.02" />
<ext:ListItem Text="0.03" />
<ext:ListItem Text="0.04" />
</Items>
</ext:ComboBox>
</Editor>
</ext:PropertyGridParameter>


The required parameter TriggerAction="All" Mode="Local" if you use inner items. We will investigate it and add code which to add these parameters if they are absent

t0ny
Oct 13, 2008, 11:34 AM
Hi there,

Thanks for your reply it works fine although I am unable get the selected value of the combobox?

Here is my property grid


<ext:PropertyGrid ID="ApplicationPropertyGrid" Border="false" runat="server" AutoWidth="true" AutoHeight="true">
<Source>
<ext:PropertyGridParameter Name="Create Application" Value="true" Mode="Raw" />
<ext:PropertyGridParameter Name="Application Pool" Value="true" Mode="Raw" />
<ext:PropertyGridParameter Name="Permissions" Value="None" >
<Editor>
<ext:ComboBox runat="server" TriggerAction="All" Mode="Local">
<Items>
<ext:ListItem Text="None" />
<ext:ListItem Text="Scripts only" />
<ext:ListItem Text="Scripts and executables" />
</Items>
</ext:ComboBox>
</Editor>
</ext:PropertyGridParameter>
</Source>
<View>
<ext:GridView ID="GridView2" ForceFit="true" runat="server" />
</View>
</ext:PropertyGrid>


and to reference the combo:


string permissions = ApplicationPropertyGrid.Source[2].Value.ToString();


It always gives me the value of "None", which is the default value. If I check the value of the dropdown it is always "";

Vladimir
Oct 13, 2008, 11:43 AM
Hi,

I can't reproduce the problem. Can you post full code of the example which reproduces the problem?

t0ny
Oct 13, 2008, 12:05 PM
I have just created a new project to simplify matters, but it seems the problem is when I drop the contents into a window...??


ASPX


<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
<!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 id="Head1" runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<ext:ScriptManager ID="ScriptManager2" runat="server"/>

<ext:Window ID="NewWebSiteWindow" runat="server" Collapsible="false"
Title="Create New Weibsite" Width="500" Height="300" BodyStyle="background:#fff;" Icon="databaseadd" Closable="false" Modal="true" Resizable="false" AutoScroll="true">
<Content>
<ext:TabPanel ID="TabPanel1" runat="server" ActiveTabIndex="0" Height="300">
<Tabs>
<ext:Tab ID="Tab1" runat="server" Title="Tab 1">
<Content>
<ext:PropertyGrid ID="ApplicationPropertyGrid" Border="false" runat="server" AutoWidth="true" AutoHeight="true">
<Source>
<ext:PropertyGridParameter Name="Create Application" Value="true" Mode="Raw" />
<ext:PropertyGridParameter Name="Application Pool" Value="true" Mode="Raw" />
<ext:PropertyGridParameter Name="Permissions" Value="None" >
<Editor>
<ext:ComboBox ID="ComboBox1" runat="server" TriggerAction="All" Mode="Local">
<Items>
<ext:ListItem Text="None" />
<ext:ListItem Text="Scripts only" />
<ext:ListItem Text="Scripts and executables" />
</Items>
</ext:ComboBox>
</Editor>
</ext:PropertyGridParameter>
</Source>
<View>
<ext:GridView ID="GridView2" ForceFit="true" runat="server" />
</View>
</ext:PropertyGrid>
</Content>
</ext:Tab>
<ext:Tab ID="Tab2" runat="server" Title="Tab 2">
<Content>
</Content>
</ext:Tab>
<ext:Tab ID="Tab3" runat="server" Title="Tab 3">
<Content>
</Content>
</ext:Tab>
</Tabs>
</ext:TabPanel>
</Content>
<Buttons>
<ext:Button ID="Button1" runat="server" Text="Submit" Icon="Accept" onclick="Button1_Click">
<AjaxEvents>
<Click OnEvent="Button1_Click">
<EventMask ShowMask="true" MinDelay="500" Msg="Creating website, please wait..." />
</Click>
</AjaxEvents>
</ext:Button>
</Buttons>
</ext:Window>


</form>
</body>
</html>


CodeBehind


protected void Button1_Click(object sender, EventArgs e)
{
string permissions = ApplicationPropertyGrid.Source[2].ValueToString();
}

Vladimir
Oct 13, 2008, 12:27 PM
Please ensure that editing ended before pressing on Submit button. I can reproduce your problem only when click on button but combobox was still active. I can suggest next solution (in Before handler stop editing)



<ext:Button ID="Button1" runat="server" Text="Submit" Icon="Accept" &#111;nclick="Button1_Click">
<AjaxEvents>
<Click OnEvent="Button1_Click" Before="#{ApplicationPropertyGrid}.stopEditing(false);">
<EventMask ShowMask="true" MinDelay="500" Msg="Creating website, please wait..." />
</Click>
</AjaxEvents>
</ext:Button>


Please let me know if it doesn't work for you

t0ny
Oct 13, 2008, 12:41 PM
Hi Vladsch,

Thanks for that, it works great!