get date and set date to textbox

Posted by Chilverupavan under Regular Expressions on 4/19/2010 | Views : 5458 | Status : [Member] | Replies : 7
i have two textboxs one is textbox1 and second is textbox2 for textbox1 i have a datepicker when i select from datepicker the date is displayed on textbox1.
but i need is to display the textbox1 selected date t0 textbox2 without using button.

need help........




Responses

Posted by: Syedshakeer on: 4/19/2010 [Member] Starter

Up
0
Down
Double click your datetime picker and write the below code { txt1.Text=datetimepicker1.Text; txt2.Text=txt1.Text;}

Syed Shakeer Hussain

Chilverupavan, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Pavanandey on: 4/20/2010 [Member] Bronze

Up
0
Down


You can do this in Text Changed event of textbox1 also.

Thanks
Pavan Kumar
Mark Answer if this fits the need

Chilverupavan, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Naveenmanam on: 4/20/2010 [Member] Starter

Up
0
Down
you must Text Changed event of textbox1 .


NaveenKumar

Chilverupavan, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Chilverupavan on: 4/20/2010 [Member] Starter

Up
0
Down
hai friends thnxs for replying for my post....
but as u said is i already implemented that there is no use....


actually my query is.........

i have two textboxs one is textbox1 and second is textbox2 for textbox1 i have a datepicker when i select from datepicker the date is displayed on textbox1.
but i need is to display the textbox1 selected date to textbox2 without using button in masterpage.................
and both the textboxs are enabled="true"; so i can i implement textchange event...............
any suggestion plz..................




Chilverupavan, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Muhilan on: 4/20/2010 [Member] Starter

Up
0
Down
Use Javascript for textbox1 selected date to textbox2



Chilverupavan, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Pavanandey on: 4/21/2010 [Member] Bronze

Up
0
Down

Since the textbox change event does not fire when date is selected u can go for onblur of firsttext box so once i select the date and the focus is out the value of first textbox is shown in the second one.

Hope this helps u

<Ajax:UpdatePanel ID="e1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<table width="100%">
<tr>
<td>
<asp:TextBox ID="T1" runat="server"/>
<asp:TextBox ID="T2" runat="server" />
</td>
</tr>
<tr>
<td>
<cc1:CalendarExtender ID="CalendarExtender1" Format="dd/MM/yyyy" PopupButtonID="T1"
runat="server" TargetControlID="T1" />
</td>
</tr>
</table>
</ContentTemplate>
</Ajax:UpdatePanel>

<script language="javascript" type="text/javascript">
function copy() {
document.getElementById('<%=T2.ClientID%>').value = document.getElementById('<%=T1.ClientID%>').value;

}
</script>

T1.Attributes.Add("OnBlur", "javascript:return copy();");

Thanks
Pavan Kumar
Mark Answer if this fits the need

Chilverupavan, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Chilverupavan on: 4/23/2010 [Member] Starter

Up
0
Down
hai friends,,


i have a probelm,,

i have two texboxs like textbox1 and textbox2 and one datepicker for textbox.
when i select date from date picker it has to select date and print to the textbox1.
and when onmousedown the textbox1 date has to add 15 days and print to the textbox2...
how to get that date from textbox1 and add 15 days to that date and dispaly in the textbox2....

this is mycode..............
===========================================================================================================================================
<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Default3" Title="Untitled Page" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">

<script type="text/javascript" language="javascript">
function test()
{

var txt1=new Date(document.getElementById("<%= regeggee.ClientID %>"));
var txt2=document.getElementById("<%=regeggee0.ClientID %>");
txt2.value=tx2.value;

}
</script>


</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

<asp:Label ID="bgcdeat" runat="server" Text="BGC INTIATED DATE:" Font-Bold="True"
ForeColor="White" Font-Names="Verdana" />

<asp:TextBox ID="regeggee" runat="server" Width="200" onmousedown="test();"/>

<asp:HyperLink ID="imgDate4" runat="server" ImageUrl="~/cal.gif">
HyperLink</asp:HyperLink>

<asp:Label ID="trgdate" runat="server" Text="TARGET DATE:" Font-Bold="True"
ForeColor="White" Font-Names="Verdana" />

<asp:TextBox ID="regeggee0" runat="server" Width="200" />

</asp:Content>


need javascript code to add days..................

Chilverupavan, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response