TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Chevy Mark Sunderland
NA
188
167.3k
Calendar problem
Mar 29 2012 11:28 AM
Hi there, I hope your appreciated help.
First of all I must say that I am a newbie when it comes to net language.
This is the GridView.
The problem is not change date value in the TextBox id="EditData" if I selected the new date in the calendar.
Why? can you help me?
Thanks in advance.
<script runat="server">
public void Page_Load (Object sender, EventArgs e)
{
OdbcConnection myConnectionString =
new OdbcConnection(
ConfigurationManager.ConnectionStrings["ConnMySQL"].ConnectionString);
myConnectionString.Open();
myConnectionString.Close();
myConnectionString.Dispose();
}
protected void calDate_SelectionChanged(object sender, EventArgs e)
{
TextBox EditmyDates = (TextBox)GridView1.Rows[GridView1.EditIndex].FindControl(" EditmyDates");
}
</script>
<script type="text/javascript">
function popupCalendar() {
var dateField = document.getElementById('dateField');
if (dateField.style.display == 'none')
dateField.style.display = 'block';
else
dateField.style.display = 'none';
}
</script>
<form id="form1" runat="server">
<div id="dateField" style="display:none;">
<asp:Calendar id="calDate" OnSelectionChanged="calDate_SelectionChanged" Runat="server" />
</div>
<div>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnMySQL %>"
ProviderName="<%$ ConnectionStrings:ConnMySQL.ProviderName %>"
SelectCommand="SELECT myDates FROM tbl_copy
ORDER BY myDates DESC"
UpdateCommand="UPDATE tbl_copy
SET myDates=? WHERE ID=?">
<UpdateParameters>
<asp:Parameter Name="ID" Type="Int32" Direction="Input" />
<asp:Parameter Name="myDates" Type="DateTime" Direction="Input" />
</UpdateParameters>
</asp:SqlDataSource>
........
<asp:TemplateField HeaderText="myDates" SortExpression="myDates">
<ItemTemplate>
<asp:Label ID="Label1" Text='<%# Bind("myDates", "{0:dd/MM/yyyy}") %>' Runat="Server"/>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox id="EditmyDates" Runat="Server"
DataSourceID="SqlDataSource1"
DataTextField="myDates"
DataValueField="myDates"
Text='<%# Bind("myDates","{0:dd/MM/yyyy}") %>'
Font-Size="8pt" Width="70" />
<img src="/images/CALEN.GIF" onclick="popupCalendar()" />
</EditItemTemplate>
</asp:TemplateField>
...
</div>
</form>
Reply
Answers (
0
)
how to show confirm box in ASP .Net
What is the difference between an EXE and a DLL