Sep 15, 2014, 11:24 AM
Combobox values not appearing in Pop up Page
Hi,
Please refer the below mentioned code part and guide us to the solution.
Parent Page:
Pop up Window
.aspx page
After the page load for the first time, the drop down shows only 7 items and the remaining records gets hidden as it doesn't show the Vertical Scroll bar.
Steps to reproduce:
1) Click on Pop it link
2) A pop up window opens. In that select Excel from the first drop down.
3) Click on the second drop down, it shows only less values without vertical scroll bar.
Refer to the screen shot.
Please refer the below mentioned code part and guide us to the solution.
Parent Page:
<%@ Page Language="C#" AutoEventWireup="true"%>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript" language="javascript">
function poptastic(url) {
var newwindow = window.open(url, 'name', 'height=150,width=500');
if (window.focus) {
newwindow.focus();
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<ext:ResourceManager ID="ScriptManager1" runat="server" Namespace="Dimension">
</ext:ResourceManager>
<a href="javascript:poptastic('/DropDownBinding.aspx');">Pop it</a>
</div>
</form>
</body>
</html>
Pop up Window
.aspx page
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="DropDownBinding.aspx.cs" Inherits="DropDownBinding" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<ext:ResourceManager ID="ScriptManager1" runat="server" Namespace="Dimension">
</ext:ResourceManager>
<ext:Store ID="store_template" runat="server" AutoLoad="true" OnReadData="GetReportTemplate">
<Model>
<ext:Model ID="Model1" runat="server">
<Fields>
<ext:ModelField Name="ReportName" />
<ext:ModelField Name="ReportId" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
<table border="0" width="500px" cellpadding="0" cellspacing="0">
<tr>
<td>
<table width="25%" align="center">
<tr>
<td>
<ext:ComboBox Cls="manitatory" ID="cmb_kind" Width="170" Editable="false" runat="server">
<Listeners>
<Select Handler=" #{store_template}.reload();" />
</Listeners>
</ext:ComboBox>
</td>
</tr>
<tr>
<td>
<ext:ComboBox ID="cmb_Template" runat="server" Width="170" StoreID="store_template"
Editable="false" DisplayField="ReportName" ValueField="ReportId" MaxHeight="1000" AutoScroll="True"
ForceSelection="true" TriggerAction="All" SelectOnFocus="false">
</ext:ComboBox>
</td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</body>
</html>
.cs fileusing System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Ext.Net;
public partial class DropDownBinding : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!X.IsAjaxRequest)
{
BindReportType();
}
}
private void BindReportType()
{
string strSelecText = "Select";
string strTypeTemplate = string.Empty;
if (!X.IsAjaxRequest)
{
Ext.Net.ListItem liType1 = new Ext.Net.ListItem();
liType1.Text = "Reports";
strTypeTemplate = "Reports";
cmb_kind.Items.Insert(0, liType1);
cmb_kind.SelectedItem.Text = liType1.Text;
Ext.Net.ListItem liType2 = new Ext.Net.ListItem();
liType2.Text = "Excel";
cmb_kind.Items.Insert(1, liType2);
}
else
{
string strText = "Reports";
strTypeTemplate = strText;
cmb_kind.InsertItem(0, strText, strText);
cmb_kind.SelectedItem.Text = strText;
strText = "Excel";
cmb_kind.InsertItem(0, strText, strText);
}
cmb_Template.ValueNotFoundText = strSelecText;
if (cmb_kind.SelectedItem.Text == strTypeTemplate)
{
List<ReportGeneraterclass> oGenerateList = new List<ReportGeneraterclass>();
oGenerateList = GetCombo1List();
this.store_template.DataSource = oGenerateList;
this.store_template.DataBind();
}
if (!X.IsAjaxRequest)
{
Ext.Net.ListItem liDefault = new Ext.Net.ListItem();
liDefault.Text = strSelecText;
cmb_Template.Items.Insert(0, liDefault);
}
else
{
cmb_Template.InsertItem(0, strSelecText, strSelecText);
}
cmb_Template.SelectedItem.Text = strSelecText;
}
internal List<ReportGeneraterclass> GetCombo1List()
{
List<ReportGeneraterclass> oList = new List<ReportGeneraterclass>();
for (int i = 0; i < 10; i++)
{
ReportGeneraterclass oReportGeneraterclass = new ReportGeneraterclass();
oReportGeneraterclass.ReportId = i;
oReportGeneraterclass.ReportName = string.Concat("Report ", i);
oList.Add(oReportGeneraterclass);
}
return oList;
}
public class ReportGeneraterclass
{
public int ReportId { get; set; }
public string ReportName { get; set; }
}
protected void GetReportTemplate(object sender, StoreReadDataEventArgs e)
{
string LStreport = "Reports";
string strSelecText = "Select";
cmb_Template.EmptyText = strSelecText;
if (cmb_kind.SelectedItem.Text == LStreport)
{
List<ReportGeneraterclass> oGenerateList = new List<ReportGeneraterclass>();
oGenerateList = GetCombo1List();
this.store_template.DataSource = oGenerateList;
this.store_template.DataBind();
}
else
{
List<ReportGeneraterclass> oGenerateList = new List<ReportGeneraterclass>();
oGenerateList = GetCombo2List();
this.store_template.DataSource = oGenerateList;
this.store_template.DataBind();
}
cmb_Template.SetValue(strSelecText);
cmb_Template.EmptyText = strSelecText;
cmb_Template.ValueNotFoundText = strSelecText;
}
internal List<ReportGeneraterclass> GetCombo2List()
{
List<ReportGeneraterclass> oList = new List<ReportGeneraterclass>();
for (int i = 0; i < 10; i++)
{
ReportGeneraterclass oReportGeneraterclass = new ReportGeneraterclass();
oReportGeneraterclass.ReportId = i;
oReportGeneraterclass.ReportName = string.Concat("Excel ", i);
oList.Add(oReportGeneraterclass);
}
return oList;
}
}
In this code part, the drop down is filled up with 10 values.After the page load for the first time, the drop down shows only 7 items and the remaining records gets hidden as it doesn't show the Vertical Scroll bar.
Steps to reproduce:
1) Click on Pop it link
2) A pop up window opens. In that select Excel from the first drop down.
3) Click on the second drop down, it shows only less values without vertical scroll bar.
Refer to the screen shot.