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
vaibhav pathak
NA
10
630
how to select button in continuous way
May 25 2016 2:30 AM
i have dynamically created buttons eg 1,2,3,4,5,6,7,8 if i select 2,3,4, then i cant select 6 and skip 4 or u can say if i select 2,3,4,5,6 then if want to deselect 4 then i have to deselect 5 and 6 first.
private void GetControls()
{
count++;
for (int i = 10; i < 12; i++)
{
for (int j = 0; j < 60; j += 15)
{
Button btn = new Button();
btn.Text = i + "-" + j;
btn.ID = i + "." + j;
btn.Command += new CommandEventHandler(this.btn_Click);
// btn.Click += btn_Click;
flag = true;
btn.CommandName = i + "-" + j;
if (count==1)
{
PlaceHolder1.Controls.Add(btn);
List<string> createdControls = Session["Controls"] != null ? Session["Controls"] as List<string> : new List<string>();
if (!createdControls.Contains(btn.ID)) createdControls.Add(btn.ID);
Session["Controls"] = createdControls;
}
}
}
}
private void btn_Click(object sender, CommandEventArgs e)
{
count++;
//ResetButton();
Button btn = sender as Button;
string ID = (sender as Button).ID;
string text = (sender as Button).Text;
ResetButton(Convert.ToDouble(ID));
Label1.Text = " Congrates! Your meeting time has been sheduled upto " + ID;
} //}
private void ResetButton(double selectedButtonID)
{
List<string> createdControls = Session["Controls"] != null ? Session["Controls"] as List<string> : new List<string>();
TimeSpan timespan = TimeSpan.FromHours(selectedButtonID);
string currentSelectedTime = timespan.ToString("h\\:mm");
foreach (string buttonID in createdControls)
{
if (!string.IsNullOrEmpty(buttonID))
{
int comparisonResult = timespan.CompareTo(TimeSpan.FromHours(Convert.ToDouble(buttonID)));
Button button = Page.FindControl(buttonID) as Button;
if (button != null && comparisonResult >= 0 )
{
if (button.BackColor == Color.Yellow)
{
button.BackColor = System.Drawing.Color.GhostWhite;
}
else if (button.BackColor == Color.GhostWhite)
{
button.BackColor = System.Drawing.Color.GhostWhite;
}
else
{
button.BackColor = System.Drawing.Color.Yellow;
}
Reply
Answers (
0
)
How to create a certificate X509 Certificate
Error :- Access to the path is denied