473,397 Members | 1,985 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Calendar in a DataGrid column

Hi,

Is there a possibility to have one of the Web Control Datagrid's column as a Calendar when editing data? Any resources on this subject?

Thanks

Mike

Nov 18 '05 #1
4 1830
Sure. Templated column.

Eliyahu
"Mike" <no****@nospam.com> wrote in message news:uB**************@TK2MSFTNGP10.phx.gbl...
Hi,

Is there a possibility to have one of the Web Control Datagrid's column as a Calendar when editing data? Any resources on this subject?

Thanks

Mike

Nov 18 '05 #2
Thanks, but is there any sample or article that you are aware of?
I am new to asp.net.

Thanks a lot.
Mike

--
Michael
"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message news:#0*************@tk2msftngp13.phx.gbl...
Sure. Templated column.

Eliyahu
"Mike" <no****@nospam.com> wrote in message news:uB**************@TK2MSFTNGP10.phx.gbl...
Hi,

Is there a possibility to have one of the Web Control Datagrid's column as a Calendar when editing data? Any resources on this subject?

Thanks

Mike

Nov 18 '05 #3
Mike,

This code uses a templated column to place a checkbox in a datagrid. It also shows how to find out which checkbox in the datagrid was clicked. I believe you'll need to do something similar for your calendar when it posts back.

I hope it helps:
How to reference a checkbox or radiobutton, etc. in a DataGrid
How to loop through a datagrid to see if a checkbox in a column is checked.

Sample Code:

First here's the grid as a reference: (I'm not showing how the data gets
bound to it.)
<asp:datagrid id="DataGrid1" runat="server" >
<columns>
<asp:templatecolumn headertext="Correct">
<itemtemplate>
<asp:checkbox autopostback="True"
oncheckedchanged="DataGridCheckBox_Changed" id="checkbox" runat="server"
visible="True"></asp:checkbox>
</itemtemplate>
</asp:templatecolumn>
<asp:boundcolumn datafield="Answer"
headertext="Answer"></asp:boundcolumn
</columns>
</asp:datagrid>

And here's how to get the row's ItemIndex when you click the checkbox:
(Note: the checkbox above is set to autopostback.)
Protected Sub DataGridCheckBox_Changed(ByVal sender As System.Object, ByVal
e As System.EventArgs)
'---Get the checkbox the user just clicked
Dim cbSent As CheckBox = CType(sender, CheckBox)

'---Prepare to loop through the datagrid
Dim mintRowsCount, mintRowsLoop, mintCountChecked, mintAllowChecked
As Integer
Dim cbCurrent As CheckBox
Dim mintRowIndexFound As Integer

'---Get the number of rows in the datagrid
mintRowsCount = DataGrid1.Items.Count() - 1

'---Loop through each row
For mintRowsLoop = 0 To mintRowsCount
'---Get the current row's checkbox
cbCurrent =
CType(DataGrid1.Items(mintRowsLoop).FindControl("c heckbox"), CheckBox)

'---Compare the current checkbox to the one clicked if they
match this is the row!
If cbCurrent.Equals(cbSent) Then
'---Get the row's Index
mintRowIndexFound =
CInt(DataGrid1.Items(mintRowsLoop).ItemIndex)

'---Exit the loop
Exit For
End If
Next

Response.Write(mintRowIndexFound.ToString)
End Sub

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Mike" <no****@nospam.com> wrote in message news:%2****************@TK2MSFTNGP12.phx.gbl...
Thanks, but is there any sample or article that you are aware of?
I am new to asp.net.

Thanks a lot.
Mike

--
Michael
"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message news:#0*************@tk2msftngp13.phx.gbl...
Sure. Templated column.

Eliyahu
"Mike" <no****@nospam.com> wrote in message news:uB**************@TK2MSFTNGP10.phx.gbl...
Hi,

Is there a possibility to have one of the Web Control Datagrid's column as a Calendar when editing data? Any resources on this subject?

Thanks

Mike

Nov 18 '05 #4
Check out this article,
http://www.microsoft.com/india/msdn/...ndarinASP.aspx

--
Saravana
Microsoft MVP - ASP.NET
www.extremeexperts.com

"Mike" <no****@nospam.com> wrote in message news:#f**************@TK2MSFTNGP12.phx.gbl...
Thanks, but is there any sample or article that you are aware of?
I am new to asp.net.

Thanks a lot.
Mike

--
Michael
"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message news:#0*************@tk2msftngp13.phx.gbl...
Sure. Templated column.

Eliyahu
"Mike" <no****@nospam.com> wrote in message news:uB**************@TK2MSFTNGP10.phx.gbl...
Hi,

Is there a possibility to have one of the Web Control Datagrid's column as a Calendar when editing data? Any resources on this subject?

Thanks

Mike

Nov 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Marco Di Gregorio | last post by:
I'm having a problem I would like to display data to a datagrid I using a Calendar When i klik to a calendar i will put a begin date and an end date into a textbox(txtBeginDate And txtEndDate)...
1
by: Jay | last post by:
Hello, I have Calendar inside a datagrid. Whenever user clicks the edit button in the datagrid calendar is visible. The problem occurs when user navigates to a particular month and picks a...
0
by: Nikkie | last post by:
Hi, In my asp.net application, I have datagrid control and a calendar control. The grid has a column for dates. All I want is, when I click on a cell in that column, the grid comes into edit...
2
by: CSL | last post by:
I am using the DataGrid in a Windows Application, how can I adjust the widths of each column individually.
0
by: Wyatt70 | last post by:
I'm attempting to implement a javascript popup calendar in a DataGrid. The calendar will be used to insert a date into a textbox. I keep getting a "System.NullReferenceException: Object reference...
2
by: Bob | last post by:
How do I show a calendar control or another appropriate control to pick a date and time for a cell in a column in a datagridview? Thanks for any help. Bob
2
by: Kajsa Anka | last post by:
Before I re-invent something I would like to ask if there exists some code that can be used for create the HTML code for a calendar which I then can include on a web page. The module in the...
6
by: caine | last post by:
I have a clickable calendar, which user can select the day that they want to view the news linking to. My calendar has the clickable event day, but once the user click it, the day selected could...
0
by: Robert Johnson | last post by:
Hi all. I have a datagrid with a couple of coulums that are datetime and I want the user to be able to use pulldown calendar to select the date. Does MS have a built in one or do I need a third...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.