Click here to Skip to main content
15,888,221 members
Home / Discussions / Database
   

Database

 
GeneralRe: Oracle Express Question Pin
Jassim Rahma7-Feb-14 22:54
Jassim Rahma7-Feb-14 22:54 
GeneralRe: Oracle Express Question Pin
Jörgen Andersson7-Feb-14 23:05
professionalJörgen Andersson7-Feb-14 23:05 
GeneralRe: Oracle Express Question Pin
Richard MacCutchan7-Feb-14 23:21
mveRichard MacCutchan7-Feb-14 23:21 
GeneralRe: Oracle Express Question Pin
Jörgen Andersson7-Feb-14 23:02
professionalJörgen Andersson7-Feb-14 23:02 
AnswerRe: Oracle Express Question Pin
Bernhard Hiller10-Feb-14 21:41
Bernhard Hiller10-Feb-14 21:41 
QuestionTable Name Pin
Sandeep Singh Shekhawat7-Feb-14 20:25
professionalSandeep Singh Shekhawat7-Feb-14 20:25 
AnswerRe: Table Name Pin
Mycroft Holmes7-Feb-14 20:35
professionalMycroft Holmes7-Feb-14 20:35 
Questionpassing data from one action to another MVC asp.net Pin
Hunain Hafeez7-Feb-14 2:49
Hunain Hafeez7-Feb-14 2:49 
i am receiving Emplid in this action,
C#
public ActionResult showDDL(int? EmplID = null) 
        {
            ViewBag.EmplID = EmplID;
            if (EmplID == null) 
            {
                IEnumerable<GetAtdRecord_SpResult> EmployeeAtd_2 = DataContext.GetAtdRecord_Sp(0).ToList();
                return View(EmployeeAtd_2);
            }
            else if (EmplID != null) 
            {
                IEnumerable<GetAtdRecord_SpResult> EmployeeAtd_2 = DataContext.GetAtdRecord_Sp(EmplID).ToList();
                return View(EmployeeAtd_2);
            }
            
            return View();
        }

View:

C#
@{
 
     var grid = new WebGrid(ViewData.Model, defaultSort: "EmplID", rowsPerPage: 20);
    
  }
  
@if (Model.Count > 0)
{
  <div id="AllEmpGrid_ByName">
   @grid.GetHtml(columns: grid.Columns(
                                        grid.Column("EmplID", "Employee ID"),
                                        grid.Column("EmplName", "Employee Name"),
                                        grid.Column("ShiftID", "Shift ID"),
                                        grid.Column("DateVisited", "Date of Visit"),
                                        grid.Column("InTime", "In Time"),
                                        grid.Column("TimeOut", "Time Out"),
                                        grid.Column("OverTime", "Over Time"),
                                        grid.Column("TotalWorkingTime", "Total Working Time")
                                      ))
 </div>
 
 using (Html.BeginForm("ToExcel", "Home", FormMethod.Get))
 {
   <button type="submit" class="button_form button_download" >Download in Excel</button>
 }
 
}
else
{
    <h2 class="error" >No Data Found</h2> 
}

In same View you can see, button DOWNLOAD IN EXCEL, i want to pass this emplID to ToExcel method

C#
public ActionResult ToExcel(int? empid )
        {
            var DataContext = new EmployeeRecordDataContext();
            
            var grid = new GridView();
            grid.DataSource = DataContext.GetAtdRecord_Sp(null).ToList();
            grid.DataBind();

            Response.ClearContent();
            Response.Buffer = true;
            Response.AddHeader("content-disposition", "attachment; filename=AttendanceSheet.xls");
            Response.ContentType = "application/ms-excel";

            Response.Charset = "";
            StringWriter sw = new StringWriter();
            System.Web.UI.HtmlTextWriter htw = new System.Web.UI.HtmlTextWriter(sw);

            grid.RenderControl(htw);

            Response.Output.Write(sw.ToString());
            Response.Flush();
            Response.End();
            return RedirectToAction("index");
        }

i can't figure out that how to pass EmplID recieved in Action 'showDDL' to EmpID when i click Button "Download in Excel" ?
SuggestionRe: passing data from one action to another MVC asp.net Pin
Richard Deeming7-Feb-14 4:07
mveRichard Deeming7-Feb-14 4:07 
Questionsum of time per month Pin
Hunain Hafeez5-Feb-14 21:10
Hunain Hafeez5-Feb-14 21:10 
AnswerRe: sum of time per month Pin
Shameel5-Feb-14 23:25
professionalShameel5-Feb-14 23:25 
GeneralRe: sum of time per month Pin
Hunain Hafeez5-Feb-14 23:44
Hunain Hafeez5-Feb-14 23:44 
AnswerRe: sum of time per month Pin
King Fisher7-Feb-14 2:24
professionalKing Fisher7-Feb-14 2:24 
Questionputting column 00:00 Pin
Hunain Hafeez4-Feb-14 23:46
Hunain Hafeez4-Feb-14 23:46 
AnswerRe: putting column 00:00 Pin
Chris Quinn5-Feb-14 5:04
Chris Quinn5-Feb-14 5:04 
AnswerRe: putting column 00:00 Pin
Mycroft Holmes5-Feb-14 11:57
professionalMycroft Holmes5-Feb-14 11:57 
Questioncommand implement loop Pin
mrkeivan3-Feb-14 21:11
mrkeivan3-Feb-14 21:11 
AnswerRe: command implement loop Pin
Chris Quinn3-Feb-14 21:20
Chris Quinn3-Feb-14 21:20 
GeneralRe: command implement loop Pin
mrkeivan3-Feb-14 21:28
mrkeivan3-Feb-14 21:28 
GeneralRe: command implement loop Pin
Chris Quinn3-Feb-14 22:02
Chris Quinn3-Feb-14 22:02 
GeneralRe: command implement loop Pin
Richard Andrew x645-Feb-14 4:56
professionalRichard Andrew x645-Feb-14 4:56 
GeneralRe: command implement loop Pin
Chris Quinn5-Feb-14 4:59
Chris Quinn5-Feb-14 4:59 
GeneralRe: command implement loop Pin
Richard Andrew x645-Feb-14 5:00
professionalRichard Andrew x645-Feb-14 5:00 
AnswerRe: command implement loop Pin
Jörgen Andersson4-Feb-14 5:04
professionalJörgen Andersson4-Feb-14 5:04 
GeneralRe: command implement loop Pin
mrkeivan7-Feb-14 18:51
mrkeivan7-Feb-14 18:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.