<
telerik:RadPanelBar
runat
=
"server"
ID
=
"RadPanelBar2"
ExpandMode
=
"SingleExpandedItem"
Width
=
"100%"
>
<
Items
>
<
telerik:RadPanelItem
ImageUrl
=
"~/Images/Att.png"
Text
=
"MojAtak"
runat
=
"server"
Expanded
=
"True"
>
<
Items
>
<
telerik:RadPanelItem
runat
=
"server"
>
<
ItemTemplate
>
<
asp:TextBox
ID
=
"ReportBox"
class
=
"text"
runat
=
"server"
Style
=
"height: 99%; width: 98%; font-size: 9px; border-style: none;"
TextMode
=
"MultiLine"
onkeyup
=
"javascript: czytaj();"
></
asp:TextBox
>
<
asp:TextBox
ID
=
"txtKto"
runat
=
"server"
class
=
"text"
Height
=
"14px"
Style
=
"width: 140px;"
Font-Size
=
"Small"
BackColor
=
"#CCFFFF"
Font-Italic
=
"True"
></
asp:TextBox
>
</
ItemTemplate
>
</
telerik:RadPanelItem
>
</
Items
>
</
telerik:RadPanelItem
>
<
telerik:RadPanelItem
ImageUrl
=
"~/Images/Cone.png"
Text
=
"Outbox"
runat
=
"server"
>
<
Items
>
<
telerik:RadPanelItem
runat
=
"server"
>
<
ItemTemplate
>
<
asp:TextBox
ID
=
"txtKogoS"
runat
=
"server"
class
=
"text"
Height
=
"14px"
Style
=
"width: 140px;"
Font-Size
=
"Small"
ReadOnly
=
"True"
BackColor
=
"#CCFFFF"
Font-Italic
=
"True"
></
asp:TextBox
>
<
asp:TextBox
ID
=
"txtDataS"
runat
=
"server"
class
=
"text"
Height
=
"14px"
Style
=
"width: 140px;"
Font-Size
=
"Small"
ReadOnly
=
"True"
BackColor
=
"#CCFFFF"
Font-Italic
=
"True"
></
asp:TextBox
>
</
ItemTemplate
>
</
telerik:RadPanelItem
>
</
Items
>
</
telerik:RadPanelItem
>
</
Items
>
</
telerik:RadPanelBar
>
<
telerik:RadScriptBlock
ID
=
"RadScriptBlock1"
runat
=
"server"
>
<
script
type
=
"text/javascript"
>
var ReportBox = '<%=((TextBox)RadPanelBar2.Items[0].Items[0].FindControl("ReportBox")).ClientID%>';
var KtoBox = '<%=((TextBox)RadPanelBar2.Items[0].Items[0].FindControl("txtKto")).ClientID%>';
function czytaj() {
alert($get(ReportBox).value);
var raport = $get(ReportBox).value;
if (raport.search("ygrał") > 0 || raport.search("z walki:") > 0 || raport.search("Remis") >= 0) {
alert("Kto");
//kto
var k1 = raport.indexOf("w.", 0);
var wynikS = raport.substring(k1 + 3);
var k2 = wynikS.indexOf("otrzyma", 0);
var kto = wynikS.substring(0, k2 - 1);
alert(kto);
alert(KtoBox);
} else {
alert("!!!!");
}
}
</
script
>
</
telerik:RadScriptBlock
>
onkeyup - I can access whatever user entered in the ‘ReportBox’ but I can’t update ‘txtKto’.
If anyone have any suggestion please go ahead. Oh and please keep in mind I'm a rookie.
Thank you
<
telerik:RadComboBox
ID
=
"CustomerSearch"
runat
=
"server"
Width
=
"180"
Height
=
"160"
MarkFirstMatch
=
"true"
AllowCustomText
=
"true"
CssClass
=
"CustomerSearch"
EnableLoadOnDemand
=
"true"
EnableVirtualScrolling
=
"true"
OnItemsRequested
=
"CustomerSearch_ItemsRequested"
OnClientSelectedIndexChanged
=
"searchnav"
EmptyMessage
=
"Select a customer"
DataSourceID
=
"dsCustomer"
DataTextField
=
"CustomerName"
DataValueField
=
"NavPath"
BackColor
=
"White"
Skin
=
"Forest"
/>
<
asp:SqlDataSource
ID
=
"dsCustomer"
runat
=
"server"
SelectCommand
=
"CustomerSearchName"
SelectCommandType
=
"StoredProcedure"
>
</
asp:SqlDataSource
>
<
telerik:RadScriptBlock
ID
=
"RadScriptBlock1"
runat
=
"server"
>
<
script
type
=
"text/javascript"
>
function searchnav(sender, args) {
var iframe = document.getElementById('ctl00_iMainPages');
iframe.src = sender.get_value();
}
</
script
>
</
telerik:RadScriptBlock
>
Protected Sub CustomerSearch_ItemsRequested(sender As Object, e As RadComboBoxItemsRequestedEventArgs)
Dim dal As New Customer
Dim data As DataTable = dal.CustomerSearchName(Session("StoreID"), e.Text).Tables(0)
Dim itemOffset As Integer = e.NumberOfItems
Dim endOffset As Integer = Math.Min(itemOffset + 10, data.Rows.Count)
e.EndOfItems = endOffset = data.Rows.Count
For i As Integer = itemOffset To endOffset - 1
CustomerSearch.Items.Add(New RadComboBoxItem(data.Rows(i)("CustomerName").ToString(), data.Rows(i)("NavPath").ToString()))
Next
e.Message = GetStatusMessage(endOffset, data.Rows.Count)
End Sub
Private Shared Function GetStatusMessage(ByVal offset As Integer, ByVal total As Integer) As String
If total <= 0 Then
Return "No matches"
End If
Return [String].Format("Items <
b
>1</
b
>-<
b
>{0}</
b
> out of <
b
>{1}</
b
>", offset, total)
End Function
protected void rdtCCno_TextChanged(object sender, EventArgs e)
{
ViewState["NumberIsDirty"] = true;
string script =string.Format(@"window.setTimeOut(function(){{$find('{0}').Focus();}},10);",rdtCvv2.ClientID);
ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "mykey", script,true);
}
protected void rdcExpMonth_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
{
ViewState["ExpMonthIsDirty"] = true;
var rdAjaxManager = RadAjaxManager.GetCurrent(this.Page);
if (rdAjaxManager != null)
{
rdAjaxManager.FocusControl(rdtAddr1);
}
}
<
telerik:RadListView
ID
=
"RadListView1"
runat
=
"server"
OnNeedDataSource
=
"RadListView1_NeedDataSource"
>
<
ItemTemplate
>
<
table
>
<
tr
>
<
td
>First Name:
<%#Eval("FirstName")%>
</
td
>
</
tr
>
<
tr
>
<
td
>
<
asp:Button
ID
=
"btnEdit"
runat
=
"server"
Text
=
"Edit"
CommandName
=
"Edit"
Width
=
"70px"
></
asp:Button
>
</
td
>
</
tr
>
</
table
>
</
ItemTemplate
>
<
EditItemTemplate
>
<
table
>
<
tr
>
<
td
>First Name:
<
asp:TextBox
ID
=
"txtFirstName"
runat
=
"server"
Text='<%#Bind("FirstName")%>'></
asp:TextBox
>
</
td
>
</
tr
>
<
tr
>
<
td
>
<
asp:Button
ID
=
"btnUpdate"
runat
=
"server"
Text
=
"Update"
CommandName
=
"Update"
Width
=
"70px"
></
asp:Button
>
</
td
>
</
tr
>
</
table
>
</
EditItemTemplate
>
protected
void
Page_Load(
object
sender, EventArgs e)
{
if
(!Page.IsPostBack)
{
RadListView1.DataSource = GetData();
}
}
protected
void
RadListView1_NeedDataSource(
object
sender, Telerik.Web.UI.RadListViewNeedDataSourceEventArgs e)
{
RadListView1.DataSource = GetData();
}
private
List<Person> GetData()
{
using
(BuildingAccessEntities ctx =
new
BuildingAccessEntities())
{
var query = from a
in
ctx.People
orderby a.FirstName
select a;
return
query.ToList();
}
}
So far, this code properly displays the populated RadListView. When I click the Edit button, the RadListView switches to Edit mode and allows me to Edit the selected record; however, when I click the Update button to save the record, the changes are not saved.
I have not yet tried to see if inserts and deletes behave this same way.
I'm sure 2-way binding should be something very simple with the RadListView, but I am new to this and have not been able to find many examples to make this work other than by using data source controls (SqlDataSource, EntityDataSource, etc.).
Any assistance will be greatly appreciated!