Quantcast
Channel: Web Forms
Viewing all articles
Browse latest Browse all 23244

selected index of one dropdown box set to all the dropdown boxes

$
0
0

hi there i have got 4drop down box as shown bellow this is to set the fatch the start time and end time

<asp:DropDownList ID="ddlStartHour" runat="server" onchange="updateDuration();"><asp:ListItem></asp:ListItem></asp:DropDownList>:<asp:DropDownList ID="ddlStartMinute" runat="server" onchange="updateDuration();"><asp:ListItem></asp:ListItem></asp:DropDownList>&#8211;                     <asp:DropDownList ID="ddlEndHour" runat="server" onchange="updateDuration();"><asp:ListItem></asp:ListItem></asp:DropDownList>:<asp:DropDownList ID="ddlEndMinute" runat="server" onchange="updateDuration();"><asp:ListItem></asp:ListItem></asp:DropDownList>                  

and in my cord behind I am setting the selected index of each dropdown according to the time value

Callout call = Callout.GetCallouts(Calloutid);             if(call.startTime.HasValue)             {                                DateTime _startdate = Convert.ToDateTime(call.startTime.Value);                ddlStartHour.SelectedIndex = _startdate.Hour+ 1;                              ddlStartMinute.SelectedIndex = _startdate.Minute + 1;                          }             else             {                 ddlStartHour.SelectedIndex = 0;                 ddlStartMinute.SelectedIndex = 0;             }                              int endH =  ddlStartHour.SelectedIndex + call.Duration.Hours;                             int endM =  ddlStartMinute.SelectedIndex +call.Duration.Minutes;                if (endH >24)                    endH = endH -24;                if (endM >59)                    endM = endM-59;

               ddlEndHour.SelectedIndex = endH + 1;                             ddlEndMinute.SelectedIndex = endM  + 1;

but it  after the update is completed both the

ddlEndHour.SelectedIndex and ddlStartHour.SelectedIndex shows the same selected index thou and ddlStartMinute.SelectedIndex and ddlEndMinute.SelectedIndex shwo the same selected index

eg. start hour i want to set as 5 and strt minut i want to set as 20 and end hour 7 and end mint to set 40 but the value is always show the same where i have go wrong appreciate all your help

 


Viewing all articles
Browse latest Browse all 23244

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>