Need to display User today task popup

Jan 28 2015 8:37 AM

Hi all,

My issue is not solving still..As Lokesh suggested me i have changed everything, but no data is passing into Modularpop window. I am unable to dispaly screenshot here otherwise i would shown the screenshot it would be helpful to understand. 

My issue is When an user login( I provided Session for Username) he need to get a popup window showing Today Task. 

Is it possible to get data using Session from database. I am posting my source code and C# code once check and let me know.  Here i am not using any default.aspx page. 

Source Code

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Loginpage.aspx.cs" Inherits="Loginpage" %>  <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server">     <title></title>    <%-- <script type="text/javascript">         var popup;         function showModalPopUp() {             popup = window.open("Default.aspx", "Popup", "width=300,height=350");             popup.focus();         } </script>--%>     <style type="text/css">         .modalBackground         {             background-color:Black;             filter:alpha(opacity=90);             opacity:0.8;         }         .modalPopup         {             background-color:#FFFFFF;            border-width:3px;            border-style:solid;            border-color:Black;            padding-top:10px;            padding-left:10px;            width:300px;            height:300px;         }          #form1         {             font-weight: 700;         }          </style> </head> <body>     <form id="form1" runat="server">    <div>     <br />     </div>     <div align="center" style="font-size: x-large; color: #0099FF">     <asp:Label ID="lblSignin" runat="server" Text="Sign In"></asp:Label>     </div>     <br />     <div align="center">        <asp:TextBox ID="txtusername" runat="server" Height="22px" Width="174px"  ValidationGroup="SignIn"></asp:TextBox>         <asp:RequiredFieldValidator ID="RequiredFieldValidatorUN" runat="server"  ValidationGroup="SignIn"             ErrorMessage="Enter Username" ControlToValidate="txtusername" Display="None"              ForeColor="Red"></asp:RequiredFieldValidator>     </div>     <br />    <div align="center">     <asp:TextBox ID="txtpassword" runat="server" Width="174px" TextMode="Password"  ValidationGroup="SignIn"></asp:TextBox>        <asp:RequiredFieldValidator ID="RequiredFieldValidatorPwd" runat="server"   ValidationGroup="SignIn"            ErrorMessage="Enter Password" ControlToValidate="txtpassword" Display="None"             ForeColor="Red"></asp:RequiredFieldValidator>     </div>     <br />     <div align="center">          <asp:Button ID="ButtonMe" runat="server" Text="Sign in"  BackColor="#33CCFF"   ValidationGroup="SignIn"             Font-Size="Medium" ForeColor="White" Width="100px" onclick="ButtonMe_Click1"                />              </div>     <br />     <div align="center">      <asp:Label ID="lblNewUser" runat="server" Text="New User ?" Font-Size="Large"              style="font-style: italic"></asp:Label>      &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;     <asp:Button ID="btnNewUser" runat="server" Text="New User" BackColor="#33CCFF"              Font-Size="Medium" ForeColor="White" Width="146px"               CausesValidation="false" onclick="btnNewUser_Click"/>     </div> <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">     </asp:ToolkitScriptManager>     <asp:Panel ID="Panel1" runat="server" CssClass="modalPopup">     <table frame="border">      <tr>      <td>      <asp:Label ID="lblId" runat="server" Text="Task Id" Visible="false"></asp:Label>      </td>                 </tr>     <tr>     <td>     <asp:Label ID="lblName" runat="server" Text="Task Name"></asp:Label></td>     <td class="style1">     <asp:TextBox ID="txtName" runat="server"></asp:TextBox>              </td>     </tr>     <tr>     <td>     <asp:Label Id="lblDescription" runat="server" Text="Description"></asp:Label>     </td>     <td class="style1">     <asp:TextBox ID="txtdescription" runat="server" TextMode="MultiLine"></asp:TextBox>             </td>     </tr>     <tr>     <td>     <asp:Label ID="lblAssigned" runat="server" Text="Assign To"></asp:Label>     </td>     <td class="style1">     &nbsp;         <asp:TextBox ID="txtAssign" runat="server" ReadOnly="true"></asp:TextBox>     </td>     </tr>     <tr> <td> <asp:Label ID="lblDate" runat="server" Text="Task Date"></asp:Label> </td> <td class="style1"> <asp:TextBox ID="txtdate" runat="server"></asp:TextBox> <asp:Button ID="Calendarbtn" runat="server" Text="..." CausesValidation="false"                       />                 <asp:calendar id="cdrCalendar" runat="server"    backcolor="#ffffff" width="250px" height="200px"    font-size="12px" font-names="Arial" borderwidth="2px"   bordercolor="#000000" nextprevformat="shortmonth"    daynameformat="firsttwoletters" Visible="False"                        >   <TodayDayStyle ForeColor="White" BackColor="Black"></TodayDayStyle>   <NextPrevStyle Font-Size="12px" Font-Bold="True" ForeColor="#333333">   </NextPrevStyle>   <DayHeaderStyle Font-Size="12px" Font-Bold="True"></DayHeaderStyle>   <TitleStyle Font-Size="14px" Font-Bold="True" BorderWidth="2px"      ForeColor="#000055"></TitleStyle>   <OtherMonthDayStyle ForeColor="#CCCCCC"></OtherMonthDayStyle> </asp:calendar>     <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server"          ControlToValidate="txtdate" ErrorMessage="Select Date"></asp:RequiredFieldValidator> </td> </tr>     <tr>     <td>     <asp:Label ID="lblTaskStart" runat="server" Text="Start Time"></asp:Label></td>     <td class="style1">     <asp:DropDownList ID="drpdwnhr" runat="server">     <asp:ListItem>01</asp:ListItem>     <asp:ListItem>02</asp:ListItem>     <asp:ListItem>03</asp:ListItem>     <asp:ListItem>04</asp:ListItem>     <asp:ListItem>05</asp:ListItem>     <asp:ListItem>06</asp:ListItem>     <asp:ListItem>07</asp:ListItem>     <asp:ListItem>08</asp:ListItem>     <asp:ListItem>09</asp:ListItem>     <asp:ListItem>10</asp:ListItem>     <asp:ListItem>11</asp:ListItem>     <asp:ListItem>12</asp:ListItem>     <asp:ListItem>11</asp:ListItem>     <asp:ListItem>12</asp:ListItem>     <asp:ListItem>13</asp:ListItem>     <asp:ListItem>14</asp:ListItem>     <asp:ListItem>15</asp:ListItem>     <asp:ListItem>16</asp:ListItem>     <asp:ListItem>17</asp:ListItem>     <asp:ListItem>18</asp:ListItem>     <asp:ListItem>19</asp:ListItem>     <asp:ListItem>20</asp:ListItem>     <asp:ListItem>21</asp:ListItem>     <asp:ListItem>22</asp:ListItem>     <asp:ListItem>23</asp:ListItem>     <asp:ListItem>24</asp:ListItem>     </asp:DropDownList>     <asp:DropDownList ID="drpdwnmin" runat="server">     <asp:ListItem>00</asp:ListItem>     <asp:ListItem>15</asp:ListItem>     <asp:ListItem>30</asp:ListItem>     <asp:ListItem>45</asp:ListItem>     </asp:DropDownList>     </td>     </tr>     <tr>     <td>     <asp:Label ID="lblend" runat="server" Text="End Time"></asp:Label></td>     <td class="style1">     <asp:DropDownList ID="DropDownListhr" runat="server">     <asp:ListItem>01</asp:ListItem>     <asp:ListItem>02</asp:ListItem>     <asp:ListItem>03</asp:ListItem>     <asp:ListItem>04</asp:ListItem>     <asp:ListItem>05</asp:ListItem>     <asp:ListItem>06</asp:ListItem>     <asp:ListItem>07</asp:ListItem>     <asp:ListItem>08</asp:ListItem>     <asp:ListItem>09</asp:ListItem>     <asp:ListItem>10</asp:ListItem>     <asp:ListItem>11</asp:ListItem>     <asp:ListItem>12</asp:ListItem>     <asp:ListItem>11</asp:ListItem>     <asp:ListItem>12</asp:ListItem>     <asp:ListItem>13</asp:ListItem>     <asp:ListItem>14</asp:ListItem>     <asp:ListItem>15</asp:ListItem>     <asp:ListItem>16</asp:ListItem>     <asp:ListItem>17</asp:ListItem>     <asp:ListItem>18</asp:ListItem>     <asp:ListItem>19</asp:ListItem>     <asp:ListItem>20</asp:ListItem>     <asp:ListItem>21</asp:ListItem>     <asp:ListItem>22</asp:ListItem>     <asp:ListItem>23</asp:ListItem>     <asp:ListItem>24</asp:ListItem>     </asp:DropDownList>     <asp:DropDownList ID="DropDownListmin" runat="server">     <asp:ListItem>00</asp:ListItem>     <asp:ListItem>15</asp:ListItem>     <asp:ListItem>30</asp:ListItem>     <asp:ListItem>45</asp:ListItem>     </asp:DropDownList>     </td>     </tr>     <tr>     <td>     <asp:Label Id="lblHours" runat="server" Text="Task hours"></asp:Label>     </td>     <td class="style1">     <asp:TextBox ID="txthours" runat="server" ></asp:TextBox>             </td>     </tr>     <tr>     <td>     <asp:Label Id="lblPriorty" runat="server" Text="Task Priority"></asp:Label>     </td>     <td class="style1">     <asp:DropDownList ID="Priority" runat="server">     <asp:ListItem></asp:ListItem>     <asp:ListItem>Very High*</asp:ListItem>     <asp:ListItem>High</asp:ListItem>     <asp:ListItem>Medium</asp:ListItem>     <asp:ListItem>Low</asp:ListItem>     </asp:DropDownList>     </td>     </tr>     <tr>     <td>     <asp:Button ID="btnok" runat="server" Text="Ok" />     </td>     <td class="style1">    &nbsp;     </td>     </tr>        </table>          </asp:Panel>     <asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server"          BackgroundCssClass="modalBackground" OkControlID="btnok"          PopupControlID="Panel1" TargetControlID="ButtonMe">     </asp:ModalPopupExtender>           </form>      </body> </html>

C# Code

using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data.SqlClient; using System.Data; using System.Configuration;  public partial class Loginpage : System.Web.UI.Page {     string connStr = ConfigurationManager.ConnectionStrings["NewTaskConnectionString"].ConnectionString;     SqlCommand com;     //SqlDataAdapter sqlda;     //DataSet ds;     string str;     protected void Page_Load(object sender, EventArgs e)     {      }      protected void btnNewUser_Click(object sender, EventArgs e)     {         Response.Redirect("Registration.aspx");     }                 protected void ButtonMe_Click1(object sender, EventArgs e)     {         SqlConnection con = new SqlConnection(connStr);         con.Open();         str = "select * from Task where Userid='" + TextBox1.Text.Trim() + "'";         com = new SqlCommand(str, con);         SqlDataReader reader = com.ExecuteReader();         if (reader.Read())         {             txtName.Text = reader["TaskName"].ToString();             txtdescription.Text = reader["TaskDescription"].ToString();             txtAssign.Text = reader["Assignedto"].ToString();             txtdate.Text = reader["Taskdate"].ToString();             drpdwnhr.SelectedValue = reader["Starttime"].ToString();             DropDownListhr.SelectedValue = reader["Endtime"].ToString();             txthours.Text = reader["Taskhours"].ToString();             Priority.SelectedValue = reader["Priority"].ToString();             reader.Close();             con.Close();             ModalPopupExtender1.Show();         }     } }

Please help me out i need to submit by enter of the day...