i want to run timer_Tick event on button click and stop timer pressing another button. this is my code
protected void Button1_Click(object sender, EventArgs e)
{
Timer1.Enabled = true;
}
protected void Timer1_Tick(object sender, EventArgs e)
{
Label2.Text = "Timer started";
//string png = IpAddress.Text.ToString(); //"192.168.153.12";//
if (IpAddress.Text == "" || IpAddress.Text == null)
{
Response.Write("Error");
}
else
{
ping1(IpAddress.Text);
ping2(Ipaddres1.Text);
}
}
Use update panel and write code Something like this.
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:Button ID="Button1" runat="server" Text="Button"
onclick="Button1_Click1" />
<asp:Timer ID="Timer1" runat="server" ontick="Timer1_Tick" Interval="2000" Enabled="False">
</asp:Timer>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<br />
<asp:Label ID="Label2" runat="server" Text="Label"></asp:Label>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
</Triggers>
</asp:UpdatePanel>
And code behind,
protected void Button1_Click(object sender, EventArgs e)
{
Timer1.Enabled = true;
}
protected void Timer1_Tick(object sender, EventArgs e)
{
Label1.Text = "Timer started";
//string png = IpAddress.Text.ToString(); //"192.168.153.12";//
if (IpAddress.Text == "" || IpAddress.Text == null)
{
Label2.Text = "Error!!!";
}
else
{
ping1(IpAddress.Text);
ping2(Ipaddres1.Text);
}
}
Related
I want do textbox_textchanged,but when i press enter key,it will do postback twice,and in my project is Serious error.It will overwrite my error message.I hope let user use textchanged,also user press enterkey can do textchanged event.
When i user google chrome i have this problem,but IE isn't have this porblem.
it's example this's my aspx.cs:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
lbl1.Text = "first load";
}
else
{
lbl1.Text = "postback=>> ispostback";
}
}
protected void ttbtest_TextChanged(object sender, EventArgs e)
{
lbl4.Text = "YOU DO ttbtest_TEXTCHANGED,YOU KEY IN:" + ttbtest.Text;
}
my aspx example:
<script src="Scripts/jquery-3.4.1.js"></script>
<script language="javascript" type="text/javascript">
function txtTextKeyDown(txt) {
if ((window.event.keyCode == 13) && txt.value != '') {
__doPostBack("ttbtest", "TextChanged");
}
else return;
}
function ConvertFindEnterKey() {
if (window.event.keyCode == 13) {
var readcode = event.srcElement.value;
__doPostBack("ttbtest", "TextChanged");
}
}
</script>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
<asp:TextBox onkeypress="javascript:return ConvertFindEnterKey();" ID="ttbtest" runat="server"
Width="250px" CssClass="CSInput" MaxLength="30" OnTextChanged="ttbtest_TextChanged" AutoPostBack="true"></asp:TextBox>
<br />
<asp:Label ID="lbl4" runat="server" />
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
</body>
I have asp:DetailsView in popup (I use modalpopupextender) and I have dropdownlist inside detailsview with autopostback. DetailView is inside updatepanel. But when I change value of dropdownlist the PageLoad function is called anyway, and dropdown index changes to 0.
<asp:Button ID="FakeClickButton5" runat="server" Text="FakeButton" CssClass="hideButton" />
<asp:Panel ID="PopupPanelDetail" runat="server" CssClass="modalPopup" >
<asp:Panel ID="Panel6" runat="server" >
<asp:UpdatePanel ID="uptblTest" UpdateMode="Conditional" runat="server">
<ContentTemplate>
<asp:DetailsView ID="DetailsViewMain" runat="server" AutoGenerateRows="false"
DataKeyNames="Id" DataSourceID="ObjectDataSourceDetailMain" Height="50px"
onitemcommand="DetailsViewMain_ItemCommand"
oniteminserted="DetailsViewMain_ItemInserted"
Width="250px" >
<Fields>
<asp:BoundField DataField="Id" HeaderText="Id"
InsertVisible="False" ReadOnly="True" SortExpression="Id"
Visible="False" />
<asp:BoundField DataField="name" HeaderText="name"
SortExpression="name" />
<asp:TemplateField HeaderText="Type">
<ItemTemplate>
<asp:DropDownList ID="ddType" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddType_OnSelectedIndexChanged" onload="ddType_Load">
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
<asp:CommandField ShowEditButton="True" ShowInsertButton="True"
Visible="False" />
</Fields>
<HeaderStyle CssClass="bold" HorizontalAlign="Center"></HeaderStyle>
</asp:DetailsView>
<asp:Panel ID="Panel7" runat="server">
<asp:LinkButton ID="SaveDetailLinkButton" runat="server" CausesValidation="True"
onclick="SaveDetailLinkButton_Click" SkinID="blackButton" ValidationGroup="ServiceValidation">Save</asp:LinkButton>
<asp:LinkButton ID="CancelDetailLinkButton3" runat="server"
onclick="CancelDetailLinkButton3_Click" SkinID="blackButton">Cancel</asp:LinkButton>
</asp:Panel>
<asp:ObjectDataSource ID="ObjectDataSourceDetailMain" runat="server"
InsertMethod="InsertParam"
SelectMethod="GetParamByID"
UpdateMethod="UpdateParam"
TypeName="DatasorceMatch"
DataObjectTypeName="ParamCustom"
OldValuesParameterFormatString="original_{0}"
oninserting="ObjectDataSourceDetailMain_Inserting" >
<SelectParameters>
<asp:ControlParameter ControlID="GridViewParams" Name="Id"
PropertyName="SelectedDataKey.Value" Type="Int32" />
</SelectParameters>
</asp:ObjectDataSource>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Panel>
</asp:Panel>
<ajaxToolkit:ModalPopupExtender ID="ModalPopupExtenderDetails" runat="server"
PopupControlID="PopupPanelDetail" TargetControlID="FakeClickButton2"
BackgroundCssClass="modalBackground" />
actually it's strange that dropdownlist reloaded because update panel mode is conditional and I don't update it in code.
Here is my server code:
protected void Page_Load(object sender, EventArgs e)
{
}
protected void DetailsViewMain_ItemCommand(object sender, DetailsViewCommandEventArgs e)
{
if (e.CommandName == "Cancel")
{
DetailsViewMain.Visible = false;
}
}
protected void DetailsViewMain_ItemInserted(object sender, DetailsViewInsertedEventArgs e)
{
GridViewParams.DataBind();
DetailsViewMain.Visible = false;
}
protected void SaveDetailLinkButton_Click(object sender, EventArgs e)
{
Page.Validate();
if (Page.IsValid)
{
GridViewParams.SelectedIndex = -1;
if (DetailsViewMain.CurrentMode == DetailsViewMode.Edit)
{
DetailsViewMain.UpdateItem(true);
}
if (DetailsViewMain.CurrentMode == DetailsViewMode.Insert)
{
DetailsViewMain.InsertItem(true);
}
ModalPopupExtenderDetails.Hide();
GridViewParams.DataBind();
}
else
{
ModalPopupExtenderDetails.Show();
}
}
protected void CancelDetailLinkButton3_Click(object sender, EventArgs e)
{
ModalPopupExtenderDetails.Hide();
GridViewParams.SelectedIndex = -1;
GridViewParams.DataBind();
}
protected void ObjectDataSourceDetailMain_Inserting(object sender, ObjectDataSourceMethodEventArgs e)
{
//int selectedID_ofType = (int)ViewState[viewState_typeID];
int selectedID_ofType = int.Parse(dropDownList_ddType.SelectedValue);
((ParamCustom)e.InputParameters[0]).typeID = selectedID_ofType;
}
protected void ddType_Load(object sender, EventArgs e)
{
dropDownList_ddType = (DropDownList)sender;
if (DetailsViewMain.CurrentMode == DetailsViewMode.Insert)
{
((DropDownList)sender).Items.Clear();
((DropDownList)sender).Items.Add(new ListItem(#"Choose", (0).ToString()));
foreach (ParamType paramType in DBHelper.sharedInstance().getAllParamTypes())
{
ListItem listItem = new ListItem(paramType.name, paramType.id.ToString());
((DropDownList)sender).Items.Add(listItem);
}
}
}
protected void ddType_OnSelectedIndexChanged(object sender, EventArgs e)
{
//int selectedID_ofType = int.Parse(((DropDownList)sender).SelectedValue);
//ViewState[viewState_typeID] = selectedID_ofType;
}
What I need is just to change values of dropdownlist without page reloading or without popup disappearing and save this value.
Hi all I have designed a radwindow manager which will have a dropdown and a textbox and a button which are placed inside a update panel.
Every thing works fine but on button click I am closing my window manager as follows
RadWindowManager1.Windows[0].VisibleOnPageLoad = false;
But this didn't work can some one help me this is my design and code
<telerik:RadWindowManager ID="RadWindowManager1" runat="server" Behavior="Default"
InitialBehavior="None">
<Windows>
<telerik:RadWindow ID="RadWindow1" runat="server" Behaviors="Default" InitialBehaviors="None"
OpenerElementID="btn" Width="650" Height="480" VisibleOnPageLoad="false">
<ContentTemplate>
<asp:UpdatePanel ID="up" runat="server" OnUnload="up_Unload">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="rdcmb" EventName="SelectedIndexChanged" />
<asp:AsyncPostBackTrigger ControlID="radbtn" EventName="Click" />
</Triggers>
<ContentTemplate>
<telerik:RadComboBox ID="rdcmb" runat="server" AutoPostBack="true" OnSelectedIndexChanged="sel">
<Items>
<telerik:RadComboBoxItem Text="One" Value="One" />
<telerik:RadComboBoxItem Text="Two" Value="Two" />
<telerik:RadComboBoxItem Text="Three" Value="Three" />
<telerik:RadComboBoxItem Text="Four" Value="Four" />
</Items>
</telerik:RadComboBox>
<telerik:RadTextBox ID="rdText" runat="server">
</telerik:RadTextBox>
<telerik:RadButton ID="radbtn" runat="server" Text="Save" OnClick="btn_Click">
</telerik:RadButton>
</ContentTemplate>
</asp:UpdatePanel>
</ContentTemplate>
</telerik:RadWindow>
</Windows>
</telerik:RadWindowManager>
<telerik:RadButton ID="rdbtnwhAnother" Text="Add WithHolding" runat="server" ButtonType="LinkButton"
OnClick="rdbtnwhAnother_Click">
</telerik:RadButton>
Code
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
RadWindowManager1.Windows[0].VisibleOnPageLoad = false;
}
}
protected void rdbtnwhAnother_Click(object sender, EventArgs e)
{
RadWindowManager1.Windows[0].VisibleOnPageLoad = true;
}
protected void btn_Click(object sender, EventArgs e)
{
RadWindowManager1.Windows[0].VisibleOnPageLoad = false;
}
protected void sel(object sender, EventArgs e)
{
rdText.Text = rdcmb.SelectedItem.Text;
}
protected void up_Unload(object sender, EventArgs e)
{
/* Cast sender as an updatePanel, and use reflection to invoke * * the page's scriptmanger registerUpdatePanel() method * * */
//RadWindowManager1.Windows[0].VisibleOnPageLoad = false;
UpdatePanel aUpdatePanel = sender as UpdatePanel;
MethodInfo m = (
from methods in typeof(ScriptManager).GetMethods(
BindingFlags.NonPublic | BindingFlags.Instance
)
where methods.Name.Equals("System.Web.UI.IScriptManagerInternal.RegisterUpdatePanel")
select methods).First<MethodInfo>();
m.Invoke(ScriptManager.GetCurrent(aUpdatePanel.Page), new object[] { aUpdatePanel });
}
<script type="text/javascript">
function getRadWindow() {
var oWindow = null;
if (window.radWindow) oWindow = window.radWindow;
else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
return oWindow;
}
function clientClose(arg) {
getRadWindow().close(arg);
}
</script>
<telerik:RadButton ID="radbtn" runat="server" Text="Save" OnClick="btn_Click">
</telerik:RadButton>
protected void btn_Click(object sender, EventArgs e)
{
string script = "clientClose('');";
ScriptManager.RegisterStartupScript(Page, typeof(Page),
"closeScript", script, true);
}
I want to refresh a GridView after selecting values in an AJAX ModalPopup. But the refresh happens only after clicking again on the select button. The refresh should happen straight after click on OK... What do I am wrong?
Greets
Marco
<div id="container" runat="server" />
<input id="dummy" type="button" style="display:none" runat="server"/>
<ajaxToolkit:ModalPopupExtender runat="server"
ID="mpeThePopup"
TargetControlID="dummy"
PopupControlID="pnlModalPopUpPanel"
DropShadow="true"/>
<asp:Panel ID="pnlModalPopUpPanel" runat="server">
<asp:UpdatePanel ID="updatePanel2" runat="server" UpdateMode="Always">
<ContentTemplate>
<asp:ListBox ID="availableCategories" runat="server" DataTextField="CategoryName" DataValueField="CategoryID" SelectionMode="Multiple"/>
<asp:Button ID="moveRight" runat="server" Text=">" OnClick="moveRightClick" />
<asp:Button ID="moveLeft" runat="server" Text="<" OnClick="moveLeftClick" />
<asp:ListBox ID="selectedCategories" runat="server" DataTextField="CategoryName" DataValueField="CategoryID" SelectionMode="Multiple"/>
<asp:Button ID="okButton" runat="server" Text="OK" OnClick="okClick" />
<asp:Button ID="cancelButton" runat="server" Text="Cancel" OnClick="cancelClick" />
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="okButton" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
</asp:Panel>
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Objects;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WebApplication2
{
public partial class Select : System.Web.UI.UserControl
{
private ObjectSet<Category> osCategories;
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
NorthwindEntities northwindEntities = new NorthwindEntities();
categories.DataSource = northwindEntities.Categories;
availableCategories.DataSource = northwindEntities.Categories;
DataBind();
}
Button showModal = new Button();
showModal.Text = "Select";
showModal.Click += new EventHandler(showModal_Click);
container.Controls.Add(showModal);
}
void showModal_Click(object sender, EventArgs e)
{
mpeThePopup.Show();
}
protected void moveRightClick(object sender, EventArgs e)
{
foreach(ListItem listItem in availableCategories.Items)
{
if(listItem.Selected)
{
selectedCategories.Items.Add(listItem);
//availableCategories.Items.Remove(listItem);
}
}
}
protected void moveLeftClick(object sender, EventArgs e)
{
foreach(ListItem listItem in selectedCategories.Items)
{
if(listItem.Selected)
{
availableCategories.Items.Add(listItem);
//selectedCategories.Items.Remove(listItem);
}
}
}
protected void okClick(object sender, EventArgs e)
{
categories.DataSource = null;
categories.DataBind();
categories.DataSource = availableCategories.SelectedItem;
categories.DataBind();
mpeThePopup.Hide();
}
protected void cancelClick(object sender, EventArgs e)
{
mpeThePopup.Hide();
}
}
}
Place your categories GridView inside an UpdatePanel with a Click AsyncPostBackTrigger on the okButton.
Like once said a picture worth one thousand word
when I press the edit button I go back to the old data, with first row in the edit mode
like the following
this is the code I use when searching with student name , or date ....
LinqDataSource1.Where = "pay_date.Contains(" +
(Convert.ToString(Convert.ToDateTime(TextBox1.Text))) + ")";
I tried to use AJAX , didn't work
I found in the linqdatasource a property called linqdatasource storeoriginalvaluesinviewstate
I made it false but go the same problem ,
.ascx
<%# Control Language="C#" AutoEventWireup="true" CodeFile="EDPayment.ascx.cs" Inherits="Admin_ED_EDPayment" %>
<asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server">
<Services>
<asp:ServiceReference Path="~/Admin/ED/Student_AutoComplete.asmx" />
</Services>
</asp:ScriptManagerProxy>
<br />
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<div>
<asp:Label ID="Label3" runat="server"
Text="Search By Student Name:"></asp:Label>
<asp:TextBox runat="server" ID="myTextBox" Width="300" ontextchanged="myTextBox_TextChanged" />
<asp:autocompleteextender
runat="server"
ID="autoComplete1"
TargetControlID="myTextBox"
ServicePath="~/Admin/ED/Student_AutoComplete.asmx"
ServiceMethod="GetCompletionList"
MinimumPrefixLength="1"
CompletionInterval="1000"
EnableCaching="true"
CompletionSetCount="12" />
<asp:Button ID="Button1" runat="server" onclick="Button1_Click"
Text="Search" />
<br />
<br />
<asp:Label ID="Label4" runat="server" Text="Search By Date:"></asp:Label>
<asp:TextBox ID="TextBox1" runat="server" ontextchanged="TextBox1_TextChanged"></asp:TextBox>
<asp:CalendarExtender ID="TextBox1_CalendarExtender" runat="server"
BehaviorID="TextBox1_CalendarExtender" Enabled="True"
TargetControlID="TextBox1">
</asp:CalendarExtender>
<asp:Button ID="Button2" runat="server" onclick="Button2_Click" Text="Search" />
<br />
<br />
<asp:Button ID="Button3" runat="server" onclick="Button3_Click"
Text="Search By Date & Name" />
<br />
<asp:Label ID="Label5" runat="server"></asp:Label>
<br />
<asp:Button ID="Button4" runat="server" onclick="Button4_Click"
Text="Show All Payments" /></div>
<asp:GridView ID="GridView1" runat="server" AllowPaging="True"
AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="pay_id"
DataSourceID="LinqDataSource1" onrowediting="GridView1_RowEditing">
<Columns>
<asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
<asp:BoundField DataField="pay_id" HeaderText="pay_id" InsertVisible="False"
ReadOnly="True" SortExpression="pay_id" />
<asp:BoundField DataField="pay_amount" HeaderText="pay_amount"
SortExpression="pay_amount" />
<asp:BoundField DataField="pay_date" HeaderText="pay_date"
SortExpression="pay_date" />
<asp:TemplateField HeaderText="pay_st_id" SortExpression="pay_st_id">
<EditItemTemplate>
<asp:DropDownList ID="DropDownList1" runat="server"
DataSourceID="LinqDataSource2" DataTextField="st_fullname"
DataValueField="st_id" SelectedValue='<%# Bind("pay_st_id") %>'>
</asp:DropDownList>
<asp:LinqDataSource ID="LinqDataSource2" runat="server"
ContextTypeName="TeacherAssistantDataContext"
OrderBy="st_fname, st_mname, st_lname" Select="new (st_fullname, st_id)"
TableName="students">
</asp:LinqDataSource>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("pay_st_id") %>'
Visible="False"></asp:Label>
<asp:DropDownList ID="DropDownList2" runat="server"
DataSourceID="LinqDataSource3" DataTextField="st_fullname"
DataValueField="st_id" Enabled="False">
</asp:DropDownList>
<asp:LinqDataSource ID="LinqDataSource3" runat="server"
ContextTypeName="TeacherAssistantDataContext"
OrderBy="st_fname, st_mname, st_lname" Select="new (st_id, st_fullname)"
TableName="students" Where="st_id == #st_id">
<WhereParameters>
<asp:ControlParameter ControlID="Label1" Name="st_id" PropertyName="Text"
Type="Int32" />
</WhereParameters>
</asp:LinqDataSource>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:LinqDataSource ID="LinqDataSource1" runat="server"
ContextTypeName="TeacherAssistantDataContext" EnableDelete="True"
EnableUpdate="True" OrderBy="pay_date, pay_amount, pay_st_id"
TableName="payments">
</asp:LinqDataSource>
</ContentTemplate>
</asp:UpdatePanel>
.ascx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Admin_ED_EDPayment : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
go1();
}
protected void go1()
{
int[] id = Searcher._Student.searchByst_fullName2(myTextBox.Text);
LinqDataSource1.Where = "pay_st_id == " + id[0].ToString();
// Parameter p = new Parameter("", System.Data.DbType.Int32, id[0].ToString());
//LinqDataSource1.WhereParameters.Add(p);
// LinqDataSource1.DataBind();
//fix();
}
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
}
protected void Button2_Click(object sender, EventArgs e)
{
go2();
}
protected void go2()
{
LinqDataSource1.Where = "pay_date == DateTime.Parse(\"" + TextBox1.Text + "\")";
fix();
}
void fix()
{
// LinqDataSource1.
}
protected void Button3_Click(object sender, EventArgs e)
{
int[] id = Searcher._Student.searchByst_fullName2(myTextBox.Text);
LinqDataSource1.Where = "pay_st_id == " + id[0].ToString() + " AND " + "pay_date == DateTime.Parse(\"" + TextBox1.Text + "\")";
}
protected void myTextBox_TextChanged(object sender, EventArgs e)
{
go1();
}
protected void TextBox1_TextChanged(object sender, EventArgs e)
{
go2();
}
protected void Button4_Click(object sender, EventArgs e)
{
LinqDataSource1.TableName = "payments";
LinqDataSource1.DataBind();
}
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{
}
}
I think you have to put your code in the page load and not in the button click and then you check first if the textbox contains data and if it contains data, apply your filter.
I think your problem is because when the page loads for the second time, the datagrid datbind function get called which gets all the data again.
try this update
<asp:LinqDataSource ID="LinqDataSource3" runat="server"
ContextTypeName="TeacherAssistantDataContext" OnSelected="LinqDataSource1_Selected"
OrderBy="st_fname, st_mname, st_lname" Select="new (st_id, st_fullname)"
TableName="students" Where="st_id == #st_id">
<WhereParameters>
<asp:ControlParameter ControlID="Label1" Name="st_id" PropertyName="Text"
Type="Int32" />
</WhereParameters>
</asp:LinqDataSource>
Code behind:
protected void LinqDataSource1_Selected(object sender, LinqDataSourceStatusEventArgs e)
{
if(!string.IsNullOrEmpty( myTextBox.Text))
{
go1();
}
if(!string.IsNullOrEmpty( TextBox1.Text))
{
go2();
}
}
I found a solution based on this topic : How can I prevent the LinqDataSource Where clause from resetting on postback? :Source
All I needed is to save the where clause of the linqdatasource and reload it again in the page_load event the final code become
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Admin_ED_EDPayment : System.Web.UI.UserControl
{
//private Boolean b1 = false, b2 = false, b3 = false;
public string MyLinqSourceWhere
{
get { return (string)this.ViewState["MyLinqSourceWhere"]; }
set { this.ViewState["MyLinqSourceWhere"] = value; }
}
protected void Page_Load(object sender, EventArgs e)
{
this.LinqDataSource1.Where = this.MyLinqSourceWhere;
}
protected void Button1_Click(object sender, EventArgs e)
{
go1();
}
protected void go1()
{
int[] id = Searcher._Student.searchByst_fullName2(myTextBox.Text);
this.MyLinqSourceWhere = "pay_st_id == " + id[0].ToString();
this.LinqDataSource1.Where = this.MyLinqSourceWhere;
}
protected void go3()
{
int[] id = Searcher._Student.searchByst_fullName2(myTextBox.Text);
this.MyLinqSourceWhere = "pay_st_id == " + id[0].ToString() + " AND " + "pay_date == DateTime.Parse(\"" + TextBox1.Text + "\")";
this.LinqDataSource1.Where = this.MyLinqSourceWhere;
}
protected void Button2_Click(object sender, EventArgs e)
{
go2();
}
protected void go2()
{
this.MyLinqSourceWhere = "pay_date == DateTime.Parse(\"" + TextBox1.Text + "\")";
this.LinqDataSource1.Where = this.MyLinqSourceWhere;
}
protected void Button3_Click(object sender, EventArgs e)
{
go3();
}
protected void myTextBox_TextChanged(object sender, EventArgs e)
{
go1();
}
protected void TextBox1_TextChanged(object sender, EventArgs e)
{
go2();
}
protected void Button4_Click(object sender, EventArgs e)
{
LinqDataSource1.TableName = "payments";
LinqDataSource1.DataBind();
}
}