I have a webGrid with 2 columns and in the first column I have Dates and in Second Column I have one more WebGrid which contains Data according to that Date. Now what I want is I want a Button in the same column in which I have my inner WebGrid.
How can I make that happen..My inner webgrid contains 4 columns in which 2 of them holds DropdownList and other two holds textbox. I want Button outside this inner WebGrid but inside the Main webGrid.
I hope I am Clear..
Here is My code
var grid = new WebGrid(Model, rowsPerPage: 100);
@if (Model != null)
{
@grid.GetHtml(htmlAttributes: new { id = "EmployeeTasksGrid" },
tableStyle: "webGrid",
headerStyle: "header",
alternatingRowStyle: "alt",
selectedRowStyle: "select",
columns:
grid.Columns(
grid.Column("TaskDate", "Task Date", style: ""),
grid.Column("EmployeeTask", "Details", format: (resource) =>
{
WebGrid resParamGrid = new WebGrid(resource.EmpTasks);
return resParamGrid.GetHtml(htmlAttributes: new { id = "EmployeeTasksSubGrid" },
tableStyle: "webGrid subgrid",
headerStyle: "header",
selectedRowStyle: "select",
columns: resParamGrid.Columns(
resParamGrid.Column("Projects", "Project name",
format:
@<div class="taskname selector projects">
@Html.DropDownList("Projects", null, "--Select--", new { id = "ddl_Projects" })
</div>, style: "TaskNameWidth"),
resParamGrid.Column("TaskNames", "Task name",
format:
@<div class="taskname selector tasks">
<input type="hidden" class="hdnActivityId" name="ActivityId" value="@item.ActivityID"/>
<input type="hidden" class="hdnRecordId" name="RecordID" value="@item.RecordID"/>
<input type="hidden" class="hdnTaskID" name="TaskName" value="@item.TaskID"/>
<input type="hidden" class="hdnProjectID" name="ProjectID" value="@item.ProjectID"/>
<input type="hidden" class="hdnTaskDate" name="TaskDate" value="@item.TaskDate"/>
<input type="hidden" class="hdnIsFreezed" name="IsFreezed" value="@item.IsFreezed"/>
@Html.DropDownList("TaskNames", null, "--Select--", new { id = "ddl_Tasks", style = "tasksnew" })
</div>, style: "TaskNameWidth"),
resParamGrid.Column("TaskDescription", "Task Description", format: @<text><textarea
rows="3" cols="3" class="taskDiss input">@item.TaskDescription</textarea>
</text>, style: "col2Width"),
resParamGrid.Column("Hours", "Hours", format: @<text><input type="text" id="Hours" value="@item.Hours" class="Hours input" onkeypress="javascript:return AllowDecimalNumber(this);" />
</text>, style: "col1Width"),
resParamGrid.Column("", style: "delete", format: @<text>
<input type="button" class="delete-task input" />
</text>, canSort: false)
),
displayHeader: true
);
})