rowCount is total number of rows
.aspx
function LoadView(rowscount) {
var tempHeight = 100;
var tempWidth = 100;
var tempLength = 100;
var tempTop = 100;
var tempLeft = 100;
if (rowscount == 1) {
tempHeight = 370;
tempWidth = 250;
tempTop = 190;
tempLeft = 500;
}
else if (rowscount == 2) {
tempHeight = 370;
tempWidth = 500;
tempTop = 190;
tempLeft = 420;
}
else if (rowscount == 3) {
tempHeight = 370;
tempWidth = 700;
tempTop = 190;
tempLeft = 350;
}
else if (rowscount == 4) {
tempHeight = 370;
tempWidth = 1000;
tempTop = 190;
tempLeft = 180;
}
else if (rowscount == 5) {
tempHeight = 600;
tempWidth = 1000;
tempTop = 140;
tempLeft = 180;
}
else if (rowscount == 6) {
tempHeight = 600;
tempWidth = 1000;
tempTop = 140;
tempLeft = 180;
}
else if (rowscount == 7) {
tempHeight = 600;
tempWidth = 1000;
tempTop = 140;
tempLeft = 180;
}
else if (rowscount == 8) {
tempHeight = 600;
tempWidth = 1000;
tempTop = 140;
tempLeft = 180;
}
else {
tempHeight = 600;
tempWidth = 1000;
tempTop = 140;
tempLeft = 180;
}
$("#dialogView").css('display', 'block');
$('#dialogView').dialog({
title: "e-Gate Pass Details",
autoOpen: true,
show: "blind",
hide: "explode",
resizable: true,
closeOnEscape: false,
open: function (event, ui) {
$(".ui-dialog-titlebar-close", ui.dialog | ui).hide();
$(".ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only", ui.dialog | ui).hide();
},
height:tempHeight,
width: tempWidth,
modal: true,
position:
{
left: tempLeft,
moveToTop: tempTop,
},
}).parent().appendTo(jQuery("form:first"));
}
2.
<div id="dialogView" style="display: none;" vertical-align: top">
<asp:Panel ID="PnlViewReq" runat="server" Enabled="true">
<asp:Button is="btnClose" runat="server" Text="Close" Style="border-radius: 5px; border: 1px solid gray; font-size: 13px;" />
<br />
<br />
<asp:Label ID="lblCont" runat="server" Text="Container No: " Style="font-weight: 600"></asp:Label>
<asp:Label ID="lblContainer" runat="server" Font-Bold="true"></asp:Label>
<br />
<br />
<%-- <table class="CommanTable">--%>
<%--<tr>
<td>
<upl:UpliftGrid runat="server" ID="grdQrDetails" Width="100%" EnableDefaultSorting="True" AllowPaging="True" AllowSorting="true" EmptyDataText="No records found" ShowHeaderWhenEmpty="true"
AutoGenerateColumns="False" BorderWidth="0px" CellPadding="0" PageSize="10" CacheDataSource="true">
<PagerStyle CssClass="paging-class" />
<RowStyle HorizontalAlign="Center" />
<Columns>
<asp:TemplateField HeaderText="e-Gate Pass File" SortExpression="e-Gate Pass">
<ItemTemplate>
<div style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap; width: 185px;">
<asp:HyperLink ID="btnFilename" runat="server" Text='<%# Eval("Filename") %>'
NavigateUrl='<%# Eval("FileOutPath") %>' Target="_blank"></asp:HyperLink>
</div>
</ItemTemplate>
<HeaderStyle Width="1%" />
<ItemStyle HorizontalAlign="left" />
</asp:TemplateField>
<asp:TemplateField HeaderText="SB No." SortExpression="SB No">
<ItemTemplate>
<asp:Label ID="lblSBNo" runat="server" Text='<%# Eval("SB_No") %>'></asp:Label>
</ItemTemplate>
<HeaderStyle Width="3%" />
<ItemStyle HorizontalAlign="left" />
</asp:TemplateField>
<asp:TemplateField HeaderText="SB Date" SortExpression="SB Date">
<ItemTemplate>
<asp:Label ID="lblSBDate" runat="server" Text='<%# Eval("SB_Date","{0:d}") %>'></asp:Label>
</ItemTemplate>
<HeaderStyle Width="3%" />
<ItemStyle HorizontalAlign="left" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Container No." SortExpression="Container No.">
<ItemTemplate>
<asp:Label ID="lblContNo" runat="server" Text='<%# Eval("CNT_NO") %>'></asp:Label>
</ItemTemplate>
<HeaderStyle Width="3%" />
<ItemStyle HorizontalAlign="left" />
</asp:TemplateField>
<asp:TemplateField HeaderText="QR Scan" SortExpression="QR Scan">
<ItemTemplate>
<asp:Image ID="Image1" runat="server" ImageUrl='<%# Eval("FilePath") %>'
Height="165px" Width="200px" onclick="OpenImage(this.id)" />
</ItemTemplate>
<HeaderStyle Width="5%" />
<ItemStyle HorizontalAlign="left" />
</asp:TemplateField>
</Columns>
</upl:UpliftGrid>
</td>
</tr>--%>
<asp:DataList ID="DataList1" runat="server" CssClass="dtlist" RepeatDirection="Horizontal" RepeatLayout="Table" RepeatColumns="4" Width="100%">
<ItemTemplate>
<table style="font-size: 12px;" class="card" id="tbldt">
<tr>
<td align="center">
<asp:Image ID="Image1" runat="server" ImageUrl='<%# Eval("FilePath") %>' class="cardimg" />
</td>
</tr>
<tr class="container">
<td>
<div style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap; width: 185px;">
<asp:HyperLink ID="btnFilename" runat="server" Text='<%# Eval("Filename") %>' NavigateUrl='<%# Eval("FileOutPath") %>' Target="_blank" Style="color: #004c98"></asp:HyperLink>
</div>
</td>
</tr>
<tr class="container">
<td>
<asp:Label ID="Label4" runat="server" Text="SB No.:"></asp:Label>
<asp:Label ID="lblSBNo" runat="server" Text='<%# Eval("SB_No") %>'></asp:Label>
</td>
</tr>
<tr class="container">
<td>
<asp:Label ID="Label7" runat="server" Text="SB Date:"></asp:Label>
<asp:Label ID="lblSBDate" runat="server" Text='<%# Eval("SB_Date","{0:d}") %>'></asp:Label>
</td>
</tr>
</table>
</ItemTemplate>
</asp:DataList>
<%-- </table>--%>
<br />
<asp:Button is="btnClose" runat="server" Text="Close" Visible="false" />
</asp:Panel>
</div>
.cs
protected void btnScanQRDetails_Click(object sender, EventArgs e)
{
try
{
if (!string.IsNullOrEmpty(hdnCodexPassId.Value))
{
int CodexPassId = Convert.ToInt32(hdnCodexPassId.Value);
DataSet ds1 = new DataSet();
ds1 = objApp.GetEGatePassData(CodexPassId);
if (ds1.Tables.Count > 0)
{
if (ds1.Tables[0].Rows.Count > 0)
{
lblContainer.Text = ds1.Tables[0].Rows[0]["CNT_NO"].ToString();
DataList1.DataSource = ds1.Tables[0];
DataList1.DataBind();
ScriptManager.RegisterStartupScript(this, GetType(), Guid.NewGuid().ToString(), "Javascript:LoadView("+ ds1.Tables[0].Rows.Count + ");", true);
}
else
{
ScriptManager.RegisterStartupScript(Page, GetType(), Guid.NewGuid().ToString(), "alert('No Record Found')", true);
}
}
else
{
ScriptManager.RegisterStartupScript(Page, GetType(), Guid.NewGuid().ToString(), "alert('No Record Found')", true);
}
}
}
catch (Exception ex)
{
throw ex;
}
}