Ext:net : Property grid bind it to store - ext.net

is there anyway to bind propertgrid to the store.
I find a sample here ,is this the only way to bind data to propertgrid?I wanna bind data like as bind the gridview thank you
<script runat="server">
protected void Populate(object sender, DirectEventArgs e)
{
PropertyGridParameter p = new PropertyGridParameter();
p.Name = "dynamic";
p.Value = "property";
p.Editor.Add(new ComboBox());
this.PropertyGrid1.SetSource(new PropertyGridParameterCollection() { p }, true);
}
</script>
<!DOCTYPE html>
<html>
<head runat="server">
<title>Ext.NET v2 Example</title>
</head>
<body>
<form runat="server">
<ext:ResourceManager runat="server" />
<ext:Button runat="server" Text="Populate" OnDirectClick="Populate" />
<ext:PropertyGrid ID="PropertyGrid1" runat="server">
<Source>
<ext:PropertyGridParameter Name="initial" Value="property" />
</Source>
</ext:PropertyGrid>
</form>
</body>
</html>

PropertyGrid internally uses its own store and its unavailable to bind data to in a similar way as you can do with a GridPanel.
I think nothing stops you to use a a common GridPanel if you have such a requirement.

Related

Password visible in ext.net user control

User control (ascx) with a password input. Right-click, inspect - the value is visible. This doesn't happen if the password input is in an aspx.
Hmm, it seems I have to add some ramblings here, since the platform won't allow me to post this thread due to "mostly code".
Default.aspx
<%# Page Language="C#" %>
<%# Register Src="UserPassword.ascx" TagName="UserPass" TagPrefix="uc" %>
<script runat="server">
protected void Page_Load( object sender, EventArgs e )
{
if ( !X.IsAjaxRequest )
{
this.BindUser();
}
}
public void BindUser()
{
userPass1.UserName = "AliBaba";
userPass1.Password = "OpenSesame";
}
</script>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Password inspect bug</title>
</head>
<body>
<form id="form1" runat="server">
<ext:ResourceManager runat="server" />
<ext:Window
ID="Window1"
runat="server"
Icon="User"
Closable="false"
Title="Customer Details"
Width="350"
Height="230"
Resizable="false"
BodyStyle="background-color:#fff;"
BodyPadding="5"
Layout="Anchor">
<Items>
<ext:Panel ID="panel1" runat="server" Header="false" Layout="FitLayout">
<Content>
<uc:UserPass ID="userPass1" runat="server"></uc:UserPass>
</Content>
</ext:Panel>
</Items>
</ext:Window>
</form>
</body>
</html>
UserPassword.ascx
<%# Control Language="C#" %>
<script runat="server">
public string UserName
{
get { return this.txtUser.Text; }
set { this.txtUser.Text = value; }
}
public string Password
{
get { return this.txtPassword.Text; }
set { this.txtPassword.Text = value; }
}
</script>
<ext:Panel ID="panel1" runat="server" BodyPadding="5" Layout="AnchorLayout">
<Items>
<ext:Panel ID="panel2" runat="server" Border="false" Header="false" AnchorHorizontal="100%" Layout="FormLayout">
<Items>
<ext:TextField ID="txtUser" runat="server" FieldLabel="User" />
<ext:TextField ID="txtPassword" runat="server" FieldLabel="Password" InputType="Password" />
</Items>
</ext:Panel>
</Items>
</ext:Panel>
Are there any known workarounds?
Short answer: Use this.txtPassword.setValue(value) not this.txtPassword.Text = value to fix your direct problem.
Long answer: Why you are setting the password from the server? Best practice states that passwords are stored as hashes on the server so you don't actually know a users real password, you are just comparing two hashes.
public string Password
{
get { return this.txtPassword.Text; }
set { this.txtPassword.Text = value; }
}
If you want to autofill a password, which i assume you do, you need to use a cookie.
if (Request.Cookies["username"] != null)
{
this.txtUsername.setValue(Request.Cookies["uid"].Value);
this.txtPassword.setValue(Request.Cookies["pwd"].Value);
}

Autentication logic form

i'm working in ext.net login form, but no idea how to implement a custom logic to take the user text field & password textfield & validate it.
here is what a had made till now.
appretiate help..
<!DOCTYPE html>
<html>
<head id="Head1" runat="server">
<title>Ext.NET Example</title>
<link type="text/css" rel="stylesheet" href="http://speed.ext.net/www/intro/css/main.css" />
</head>
<body>
<form id="Form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<ext:Window runat="server" Width="300" Height="200" Draggable="False" Closable="False" Icon="Lock" Title="Loging" BodyPadding="5">
<Items>
<ext:TextField runat="server" Text="Demo" FieldLabel="user" BlankText="ur name is required" AllowBlank="False" ReadOnly="False"/>
<ext:TextField runat="server" Text="password" FieldLabel="pass" BlankText="Pass required" AllowBlank="False" ReadOnly="False" />
</Items>
<Buttons>
<ext:Button runat="server" ID="buton" Icon="Accept" Text="Submit" >
<Listeners>
<Click Handler="init"></Click>
</Listeners>
</ext:Button>
</Buttons>
</ext:Window>
</form>
</body>
</html>
There's a login form with browsers 'saving' functionality (allows google chrome to ask you to "save" the password. This is a full transcript of the example which can be accessed at http://examples4.ext.net/#/Form/Login/Auto_Complete/.
<%# Page Language="C#" %>
<script runat="server">
protected void Button1_Click(object sender, DirectEventArgs e)
{
// Do some Authentication...
if (e.ExtraParams["user"] != "Ext.NET" || e.ExtraParams["pass"] != "extnet")
{
e.Success = false;
e.ErrorMessage = "Invalid username or password.";
}
}
</script>
<!DOCTYPE html>
<html>
<head runat="server">
<title>Login - Ext.NET Examples</title>
<link href="/resources/css/examples.css" rel="stylesheet" />
<script>
// Invalidate the login fields with the given reason.
var invalidateLogin = function(reason) {
App.txtUsername.setValidation(reason);
App.txtPassword.setValidation(reason);
App.txtUsername.validate();
App.txtPassword.validate();
Ext.MessageBox.show({
title: 'Authentication error',
msg: reason,
buttons: Ext.MessageBox.OK,
animateTarget: 'Window1',
icon: 'Error'
});
};
var handleLogin = function() {
var form = App.Window1.el.up().dom; // Window1 is a direct child of the form element.
App.Window1.close();
// Now this would work for Chrome, and we already triggered autoComplete for IE.
// Chrome's is only triggered after the destination page is loaded.
setForm(form, "../../../Desktop/Introduction/Overview/Desktop.aspx", form.target);
form.submit();
restoreForm(form);
};
var orgFormAction, orgFormTarget,
btn = null, iframe = null;
// If we are on IE, we will create a button and click it (at once),
// so autoComplete is triggered.
var handleClientClick = function() {
var form = App.Window1.el.up().dom; // Window1 is a direct child of the form element.
if (Ext.isIE) {
if (iframe == null) {
iframe = document.createElement("IFRAME");
iframe.name = "ie_login_flush";
iframe.style.display = "none";
form.appendChild(iframe);
}
if (btn == null) {
btn = document.createElement("BUTTON");
btn.type = "submit";
btn.id = "submitButton";
btn.style.display="none";
form.appendChild(btn);
}
// On WebForms, we have to force set the form settings as we run or else we'll
// break directEvent calls.
setForm(form, "about:blank", "ie_login_flush");
btn.click();
restoreForm(form);
}
}
var setForm = function(form, action, target) {
// Back up original settings once per execution.
if (typeof orgFormAction == 'undefined') {
orgFormAction = form.action;
}
if (typeof orgFormTarget == 'undefined') {
orgFormTarget = form.target;
}
form.action = action;
form.target = target;
};
var restoreForm = function(form) {
form.action = orgFormAction;
form.target = orgFormTarget;
};
</script>
</head>
<body>
<form runat="server">
<ext:ResourceManager runat="server" />
<h1>Logging with browser saving functionality</h1>
<p>The valid login/password combination here would be:</p>
<p>
Username: Ext.NET<br>
Password: extnet
</p>
<p>On successful authentication, you will be redirected to the Desktop example.</p>
<ext:Window
ID="Window1"
runat="server"
Closable="false"
Resizable="false"
Height="200"
Icon="Lock"
Title="Login"
Draggable="true"
Width="350"
Modal="false"
BodyPadding="5"
Layout="Form">
<Items>
<ext:TextField
ID="txtUsername"
runat="server"
Name="username"
FieldLabel="Username"
AllowBlank="false"
BlankText="Your username is required." />
<ext:TextField
ID="txtPassword"
runat="server"
Name="password"
InputType="Password"
FieldLabel="Password"
AllowBlank="false"
BlankText="Your password is required." />
</Items>
<Buttons>
<ext:Button
ID="Button1"
runat="server"
Text="Login"
Icon="Accept"
FormBind="true"
Handler="handleClientClick">
<DirectEvents>
<Click
OnEvent="Button1_Click"
Success="handleLogin"
Failure="invalidateLogin(result.errorMessage);"
ShowWarningOnFailure="false">
<EventMask ShowMask="true" Msg="Verifying..." MinDelay="1000" />
<ExtraParams>
<ext:Parameter Name="user" Value="App.txtUsername.value" Mode="Raw" />
<ext:Parameter Name="pass" Value="App.txtPassword.value" Mode="Raw" />
</ExtraParams>
</Click>
</DirectEvents>
</ext:Button>
</Buttons>
</ext:Window>
</form>
</body>
</html>

jquery autocomplete in ASP not working

I have googled for this and I am not an expert on it either. I tried the following code thinking I am doing it right to implement a simple autocomplete textbox. But does not work. Here is the code. If anyone would help out what could be wrong with it, that will be a big help. My textbox simply does not return any autocomplete suggestions when I try it.
Thanks.
<%# Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="jquery.WebForm1" %>
<!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">
<%--<link href="jquery-ui-1.8.13.custom.css" rel="stylesheet" type="text/css" />--%>
<title></title>
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css"
rel="stylesheet" type="text/css"/>
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.6.1.min.js" type="text/javascript"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>
</head>
<body>
<form id="form1" runat="server">
<div>
<script type="text/javascript">
$(function () {
$("#TextBox1").autocomplete
({
source: ["Joe", "John", "Jack", "Ben", "Bell", "Steve", "Scott"] // simple list of strings
});
});
</script>
<asp:Button ID="Button1" runat="server" Text="Button" />
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<br />
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
</div>
</form>
</body>
</html>
There is no reference for jquery ui library in ur code
TRY TO ADD THIS :
<script src="https://code.jquery.com/ui/1.10.3/jquery-ui.min.js" type="text/javascript"></script>

Combo box listener in ext.net

I have an Ext.Net.ComboBox. It has been populated by using a sql query.
Now I need to filter the elements of the combo box based on the text entered.
For eg.
comboBox contains the following value.
Test1
Test2
MyTest
ComboTest
So when I enter the value 'Com' in the comboBox it should filter and display only ComboTest.
But if I enter Test then Test1, Test2 and ComboTest should be shown.
Please help me out. Thanks in Advance.
Edit : Refer this
Try the following based on this thread: http://forums.ext.net/showthread.php?16466-CLOSED-combobox-search-pattern
<%# Page Language="C#" %>
<%# Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (!X.IsAjaxRequest)
{
Store store = this.ComboBox1.GetStore();
store.DataSource = new object[]
{
new object[] { "1", "ab" },
new object[] { "2", "ac" },
new object[] { "3", "ba" },
new object[] { "4", "bc" },
new object[] { "5", "ca" },
new object[] { "6", "cb" }
};
store.DataBind();
}
}
</script>
<!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>Ext.Net Example</title>
</head>
<body>
<form runat="server">
<ext:ResourceManager runat="server" />
<ext:ComboBox
ID="ComboBox1"
runat="server"
MinChars="1"
Mode="Local">
<Store>
<ext:Store runat="server">
<Reader>
<ext:ArrayReader>
<Fields>
<ext:RecordField Name="value" />
<ext:RecordField Name="text" />
</Fields>
</ext:ArrayReader>
</Reader>
</ext:Store>
</Store>
<Listeners>
<BeforeQuery Handler="var q = queryEvent.query;
queryEvent.query = new RegExp(q);
queryEvent.query.length = q.length;" />
</Listeners>
</ext:ComboBox>
</form>
</body>
</html>

Ext.NET 2.0 how to get the value of datefield

I want to get from datefield. Ext.NET 2.0 is a little bit difficult to study.
This is a source of simple datefield.
<ext:DateField ID="DateField1" runat="server"
Vtype="daterange" FieldLabel="To" EnableKeyEvents="true" />
and I'd like to set the value on my Textbox.
myTextbox.setValue(App.MainContent_DateField1.getValue());
help!!
Just found the answer to this - using getRawValue() function
myTextbox.setValue(App.MainContent_DateField1.getRawValue());
I tested the basic scenario and it appears to work correctly.
You might need to call .format() to convert your DateField value into a nicely formatted string, but that is not required.
Here's a full sample demonstrating the scenario. Select a Date from the DateField, then click the Button. The DateField value will be copied to the TextField.
Example
<%# Page Language="C#" %>
<%# Register assembly="Ext.Net" namespace="Ext.Net" tagprefix="ext" %>
<!DOCTYPE html>
<html>
<head runat="server">
<title>Ext.NET Example</title>
</head>
<body>
<form runat="server">
<ext:ResourceManager runat="server" />
<ext:DateField ID="DateField1" runat="server" />
<ext:TextField ID="TextField1" runat="server" />
<ext:Button
runat="server"
Text="Submit"
OnClientClick="TextField1.setValue(DateField1.getValue().format('d-M-Y'));"
/>
</form>
</body>
</html>

Resources