how ontextchanged event in datalist fire and when that textbox value change than another textbox inside datalist value also change

 i have one datalist into which i used maskededit extender for time entry there is three textbox

(1) start_time (2) end_time (3) duration

so when enter  end_date value than this text box ontextchage event fire and duration will automatically calculate by

(end_time - start_time) and display into datalist duration textbox. in datalist there is more than one item.

i put some code so just check

 

 <asp:DataList ID="CONTRACT_SERVICE_ITEM" runat="Server" RepeatColumns="1" RepeatDirection="Horizontal"
                Width="100%">
                 <ItemTemplate>
                    <table width="100%" cellpadding="0" cellspacing="0">
                        <tr>
                            <td>
                                <asp:TextBox ID="SERVICE_ITEM_TYPE" runat="Server" Enabled="false" Text='<%# Eval("SERVICE_ITEM_TITLE_BY_CUSTOMER") %>'></asp:TextBox>
                                <asp:Label ID="INVOICE_DETAIL_ID" runat="server" Text='<%# Eval("INVOICE_DETAIL_ID") %>' Visible="false"></asp:Label>
                               
                            </td>
                            <td>
                                <asp:TextBox ID="START_TIME" runat="server" CssClass="FormBox" Width="175" OnTextChanged="START_TIME_TextChanged"></asp:TextBox>
                                <cc1:MaskedEditExtender ID="meeSTART_TIME" TargetControlID="START_TIME" UserTimeFormat="TwentyFourHour"
                                    runat="server" MaskType="Time" Mask="99:99:99">
                                </cc1:MaskedEditExtender>
                            </td>
                            <td>
                                <asp:TextBox ID="END_TIME" runat="server" CssClass="FormBox" Width="175" AutoPostBack="True"
                                    OnTextChanged="END_TIME_TextChanged"></asp:TextBox>
                                <cc1:MaskedEditExtender ID="meeEND_TIME" TargetControlID="END_TIME" UserTimeFormat="TwentyFourHour"
                                    runat="server" MaskType="Time" Mask="99:99:99">
                                </cc1:MaskedEditExtender>
                            </td>
                            <td>
                            <asp:TextBox ID="DURATION" runat="server" CssClass="FormBox" Width="175"></asp:TextBox>
                            </td>
                        </tr>
                    </table>
                </ItemTemplate>
            </asp:DataList>

 

so please i am in new in asp.net so please any one give me solution with example thank's a lot in advance 

0
hardik
7/25/2008 6:56:27 PM
asp.net.presentation-controls 72751 articles. 3 followers. Follow

1 Replies
1799 Views

Similar Articles

[PageSpeed] 4

Hi hardik.vaishnav,

Try this TextChanged event:

protected void END_TIME_TextChanged(object sender, EventArgs e)
{
    DataListItem dli = (DataListItem)((TextBox)sender).Parent;
    TextBox tb_end = (TextBox)dli.FindControl("END_TIME");
    TextBox tb_start = (TextBox)dli.FindControl("START_TIME");
    TextBox tb_duration = (TextBox)dli.FindControl("DURATION");
    tb_duration.Text = (Convert.ToInt32(tb_end.Text) - Convert.ToInt32(tb_start.Text)).ToString();    //you can change to convert any data type according to your input data
}

Thanks,


Qin Dian Tang
Microsoft Online Community Support

Please remember to mark the replies as answers if they help and unmark them if they provide no help.
0
Qin
7/29/2008 9:16:31 AM
Reply:

Similar Artilces:

Changing a textbox value by changing 2 other textboxes inside of a FormView
Ok...here goes.  I want to be able to dynamically change the value of a textbox by changing the value of 2 other textboxes.  I have 4 textboxes, txt1, txt2, txtDB, and txtTotal.  These are all inside of FormView1 which is inside of UserControl1.ascx which is inside of UserControl1.aspx.   The goal is to have txtTotal read the summation of the 3 other textboxes.  txtDB has a bound value read from a database (why it is in a FormView).  txt1 and txt2 can be changed.  I want though, for the txtTotal textbox to change in real time wit...

how to change the value of checkbox when i change the value of textbox
i want the checkbox to change its value to unchecked when the textbox doesnot have anything i.e is value is "" and as soon as i enter anything to it, the checkbox should automatically change to checked. Can you please tell me how to do this Add to the textbox: OnKeyUp="CheckValue()" Add to the html: <script language="javaScript"> function CheckValue() { if (document.getElementById('textboxid').value.length == 0) { document.getElementById('checkboxid').checked = false; } else { document.getElementById('checkboxid').checked...

Set TextBox text value to value from DataList Control
I'm sure this is a totally sad question to ask, but... I am using a DataList View to display data. I have a separate form within a LoginView that I would like to use to update a few main fields. I want to set the Text property of the TextBox in my custom edit form to the value of the corresponding field in the DataList. Is this possible? I think i get your question --> you want the text from a  textbox from the datalist to be input into a textbox within your form? try:TextBox tb = DataList1.FindControl("TextBoxIDToFind"); TextBoxOnForm.Text = tb.Text;David Ki...

How to change textbox value in formview by another textbox which outside formview?
Currently i got two question about formview... First, is there any way to change the property of CheckBox1.Checked which it's inside FormView by clicking on CheckBoxOutside.Checked which it's located outside FormView  Second, is basically the same as the first one... just that how to externally click on the Update link inside the formview from a Button outside the FormView By the way im using Visual Basic Hi, sortm: FormView has an UpdateItem method, which enable you to update the item without clicking Update button,like   Protected Sub Button1_Click(ByVal sender...

help! onBlur firing before value changed? Wrong values coming from textboxes
Hey developers! I'm trying to create a clint side system for calculating my total on a line of a purchase order. (i.e. Quantity * Price = lineTotal)  I wanted to do this client side so there were no silly postbacks for such a simple calculation.  I created an onBlur event for the control and linked it to a calculateTotal() method.  Something like this: .CS code txtQty.Attributes.Add("onBlur", "CalculateTotal();"); txtPrice.Attributes.Add("onBlur", "CalculateTotal();"); .ASPX code/scriptfunction CalculateTotal() {  va...

How to find a Control inside a Datalist(DataList also inside in a DataList)
I search the forum but i couldn't find the solution. Most examples written in VB.NET. I have Datalist(DataList1) showing some data and inside DataList1 there is one more DataList(DataList2). Inside DataList2 there are checkboxes. Outside of DataList1 there is Button(Button1). What i want is, when i click Button1, it wil find the CheckBoxes which is checked , and gets their Text property and assign it to a string or something. Will be very appreciated for help. Waiting for answers. I am using VS.2005 and coding with C#.  Here is a example schema: #DataList1######################...

Change Value of a Textbox that is inside of a FormView using Vb.Net code behind.
I am having trouble adding text to a textbox that is nested in a form. What I want to do is pre-fill out the insertview form if the user already has their info on file so they don't have to fill out the name, address, etc. each time. Any help will be greatly appreciated.Dan5150www.5150creations.com Hi, You need to define a variables as textbox and assign them to the textbox controls within the FormView by using 'FindControl'. E.g.  Dim MyText As TextBox = CType(FormView1.FindControl("txtMyTextbox"), TextBox) Then you can set the TextBox text value as follow...

Prevent Textbox text changed event fired during postback caused by another control
Hi   I am working on a .NET 3.5 application. I have 3 text box controls on my web page and 2 buttons. I have set AutoPostback to true for all the text boxes. When i change the text and press enter text changed event is fired for that text box. when textbox1 has focus and if i click on a button textchanged event is fired for that textbox. I want to prevent this. I want to prevent the following scenarios.  Scenario 1:    Textbox1 has focus. I click on textbox2 and change the text. Both Textbox1_textchanged and Textbox2_textchanged events are fired.  (i want to c...

I Used Repeater inside the Datalist now i want to get value of Repeater (textbox control)
I Used Repeater inside the Datalist now i want to get value of Repeater (textbox control) on button click. Button is inside the datalist, Outside repeater.  Depending on datalist "groupId" Repeater is loding and from the repeater i want the value of "Textqty". This is my code <asp:DataList ID="DataList1" runat="server" class="SubContentSearch" DataSourceID="ObjectDataSource1" Width="496px" DataKeyField="id"><ItemTemplate> <asp:Label ID="groupIdLabel" runat="server" Te...

DataList Label Value
Hi all, I have a DataList with a label in it that I am trying to change the value of depending on the value pulled from the database.  I bind the label using the following code: Container.DataItem("Size") The value of size from the database can either be A, B, or C.  What I would like to do is change the text of the label depending on the value. i.e A = 'Too much' B = 'Too Little' C = 'Just Right' Any thoughts would be greatly appreciated. Regards, TCM_...

Changing textbox.Text value when dropdownlist changes
I figure this should be really simple. Here's what I want to happen: Page loads first time, textbox is blank. User changes dropdownlist to a certain value. Page refreshes and changes textbox.text to dropdownlist.SelectedItem.Value but keeps the value of any other textboxes that might've been changed by the user. I can make this work fine when it's just dynamic (non asp.net generated) text in the page. Thanks. hello, there is the OnSelectedIndexChanged which you should define,in that method you set the value of the textbox as follows: txt1.Text = ddl.SelectedItem.Value; ...

Change value of textbox dependent on value from dropdownlist
How do you achieve this but client-side, to avoid the constant page refresh? (Javascript)   Best, Asaf. You need to use an onChange event on your DropDownList and wire it to a JavaScript function. In the code example below, ddlID and txtID are the control IDs of your DropDownList and TextBox controls. Code: ddlID.Attributes.Add("onChange", "setText('" + ddlID.ClientID + "', '" + txtID.ClientID + "');"); JavaScript: function setText(ddl, txt){   var ddlID = document.getElementById(ddl);   var txtID = document.getElementById(txt);   &...

How to change the name value of attributes of textbox control that added DataGrid control?
I created a DataGrid and added a textbox control as a template column and binded a DataSet as for DataSource in my webform1.aspx. when you looked at the HTML format souce code of dataGrid after that have generated . i found all the textbox named with datagrid,textbox and a random number. The question is how can i rename it in running time? i have tried some times in different event of datagrid  but i fail! thanks. Of course the ID of the textbox will not be the same as you named it, because datagrid contains lots of rows and each row will have a textbox, so to...

Changing the value of one cell when the user changes the value of another cell
I am using a standard GridView with multiple columns and a SQLDataSource. One column is called Qty and another column is called Date. When the user clicks the Edit button and enters a quantity into the Qty column, I would like to automatically fill in today's date into the Date column...before the user clicks Save. Any ideas on how to do that? Thanks in advance, Rick     You would have to make an asych call, check out ASP.NET AJAX: http://ajax.asp.net add a javascript event on the quantity textbox the onchange On the gridviews rowdatabound add this  Protected Sub Gr...

DataList
Hi guys. What i want to do is display a different text value with the value returned from the db based on what is returned from the database for that field. I would like to display that into a label within a Datalist I thought i could do something along these lines. <asp:Label id ="lblStock"> <% #Sub( DataBinder.Eval (Container.DataItem, "IntegerField"))%> </asp:Label> Create the Sub and based on the Integer Field with some conditional operations Then write the lblStock.Text propery + the IntegerField value. Can something like that be done or will i have ...

How to update gridview with dropdownbox and textbox values after changing the values
I have papulate the gridview with Dropdownbox(Quantity) and Textbox for price and Product details after updating the quantity and price through javascript, I want to insert into database How can i do help me please<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" Width="100%" CellPadding="4" ForeColor="#333333" GridLines="None" OnRowDataBound="GridView1_RowDataBound" >        <Columns>          &...

Change value into dg textbox but it catches old value
A datagrid is populated by an arraylist.When I'll update: Even changing text, i.e., writing a new text into textbox, the text continue the last one, without changesI turn off viewstate from textbox but nothing yet What is going on? Some help will be appreciated, thanks a lotBest regards,Ivan Andrade Are you dataBinding you datagrid on pageLoad?  If so, wrap if(!IsPostBack) around your databinding.If everything happens for a reason what is the reason for this error?...

Value of textbox and/or label inside of a DataList
Hello everyone, I have a datalist that's bound to a TableAdapter. Inside of the DataList I have the following field (several other fields as well): <asp:Label ID="lblEmailAddress" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "Email_addr")%>'></asp:Label> Everything is displaying perfectly. I don't have a problem displaying these fields. The problem I have is, I need to get the value of lblEmailAddress in my code-behind. I can display it, but I can't get the value of it. Once this code is in the DataList, it's no longer available. I have searched the...

Retrieving the value of a textBox inside a DataList
Hello! I have a DataList ("DL") with a HTML table inside it. The DL is bounded from a database with 2 columns "UserID" and "UserName" the table has 2 columns, one containing a label with the UserID and another one containing a textBox that should be manually filled with the User´s Name. The TextBox ID is "UserName" My problem is that when the dataList is bounded the TextBox´s Id looks like DL:_ctl0:UserName DL:_ctl1:UserName DL:_ctl2:UserName ... and so on. I have an update button that should insert tha usernames in ...

How to read the value of a textbox inside a datalist
 Hello,             I have a datalist and i have the data organized in it in the below formattextBox1updateButton1 I want to read the value of the textbox1 on the click of the update button to update the database. Can anyone please let me know the syntax to read the value of textbox1 which is present in the datalist. I will then pass that value to the comand argument of the updateButton1.RegardsHussain Haideri Specify CommandName to your UpdateButton. Then in the ItemCommand event of the DataList, we can find the control like below protected vo...

DataList control inside another dataList control...
one of my aspx page requires to display data from a master table and show another set of data inside each row from a child table i tried by putting a datalist another datalist but could not make it i get errors :: CODE :: Dim ObjChildRental As DataList() Dim StrRentalSql As String = "select rentalid,startdate,enddate,amount,lookup.lookupname as curr from rental inner join lookup on lookup.lookupid=rental.currencyid where rental.propertyid=1" ObjChildRental = DLPropertyMaster.FindControl("dlpropertymaster:_ctl0:dlrental") M.BindDataList(ObjChild...

Change value of textbox based on value from dropdownlist using ajax?
Hello, I want to program an aspx form so that depending on what value you select from a dropdownlist, a textbox gets populated using ajax or javasciprt (client based) I did this already server-side by reading from an SQL data table, but it's annoying because of the page refresh, anyway to do the same thing using ajax or javascript? Look at my code below:   Many thanks ! :)   Sub ddllocations_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddllocations.SelectedIndexChanged Dim strconn As String Dim myConnection As New SqlConnection(strconn) ...

change dropdownlist's selected value on textbox change
Hi there, I have one dropdownlist and textbox in template column of gridview. Now whenever grideview is in edit mode user can change textbox and dropdown value. Now I want to set dropdownlist's selected index to 0 when user enter any value in text box using javascript. i m new to javascript. Is there any idea to implement this? Check this out.   var ddl = document.getElementById('<%#dropdownlistname.ClientID%>'); ddl.selectedIndex = 0;    Thanks,santosh_maharajaPlease mark as answer if you got expected solution. this wayprotected void gvw_RowDataBound(object sender, GridViewRowEventArgs e) {if (e.Row.RowType.Equals(DataControlRowType.DataRow)){DropDownList ddl = (e.Row.Cells[N].Controls[N] as DropDownList) Textbox txt = (e.Row.Cells[N].Controls[N] as TextBox) txt.attributes.add("onkeypress",string.Format("document.getElementById('{0}').selectedIndex=0",ddl.ClientID)) } } SHASHANK BHIDECAPGEMINI INDIA"THE ROAD TO SUCCESS IS ALWAYS UNDER CONSTRUCTION MARK MY RESPONSE AS ANSWER TO HELP ME BUILD IT :)" hi,add javascript function to the text box onblur event with this as argument.In that function now you can access the textbox control and at the same time you can change the dropdown selected value. Mark as ANSWER if you got the solution from this post. Regards,Ravi Kishore.ChMark as "ANSWER" if you got the solution from this post.  Hi I put the below code in textbox ...

Changing textbox value back to original value when closing popup
Hi, On my webform, I have 4 textboxes and a submit button. If the user changes the value in the first textbox then submits the form, a popup window appears that has an "Are you sure ..." message, a Yes button, and a No button. If the user presses No, I want to close the popup and return the value of the first textbox back to its original value (before the user changed it). I can get the popup to close; I just can't figure out how to get the first textbox to have its original value. Any ideas? Thanks in advance, Suzanne You could use this javascript: window...

Web resources about - how ontextchanged event in datalist fire and when that textbox value change than another textbox inside datalist value also change - asp.net.presentation-controls

LogFragment.java - Android Developers
1 /* 2 * Copyright 2013 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not ...

vogella blog - Because knowledge feels like magic. - Page 26
package de.vogella.android.list.filter;import java.util.ArrayList;import java.util.List;import android.app.ListActivity;import android.os.Bundle;import ...

Uses of Package butterknife (Butter Knife 7.0.0 API)
Skip navigation links Package Class Use Tree Deprecated Index Help Prev Next Frames No Frames All Classes Uses of Package butterknife Classes ...

Using MVVM with the AutoCompleteTextBox in Silverlight 4
... be found below. public class ImmediateUpdateBehavior : Behavior { protected override void OnAttached() { AssociatedObject.TextChanged += OnTextChanged; ...

EasyTextWatcher.java - Android Developers
1 /* 2 * Copyright (C) 2014 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may ...

Resources last updated: 3/3/2016 9:55:25 AM