.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Postback Problem using Lightbox with DropDownList

Posted By:      Posted Date: September 22, 2010    Points: 0   Category :ASP.Net

Hi all,

I have two sites: "Default.aspx" and "mySubsite.aspx". In "Default.aspx" I have a hyperlink to open a lightbox window, which works perfectly.

Here is the code for it:

<asp:UpdatePanel ID="UpdatePanel1" runat="server"> 
<a href="mySubsite.aspx" class="lbOn">Open Lightbox Window</a>

When the lightbox window opens("mySubsite.aspx.cs") I placed two drop down lists ( parent child use) . First DDL contains all the parent names and the second DDL returns the subname to the corresponding parent name. So basically I select a parent item and get the right subname for it.

Code for it looks this way.

protected void Page_Load(object sender, EventArgs e)

if (!IsPostBack)
DDLParent.DataSource = data_string;


protected void DDLParent_SelectedIndexChanged(object sender, EventArgs e)

View Complete Post

More Related Resource Links

styling dropdownlist problem


Dear All,

im facing a problem while styling my ddl, what i did is:

<div><asp ropDownList ID="DropDownList1" runat="server" style="background-color:Transparent;" Width="100%">
    </asp: dropDownList></div>

<div class="stlGradient">
<asp ropDownList ID="DropDownList1" runat="server" style="background-color:Transparent;border:none;" Width="100%"></asp: dropDownList>

the DIV style is having a bg image repeated X.

now this worked on Firefox
on google Chrome: the border gone but the background still white
on IE 7: nothing happend

thanks for helping.

page postback problem with crystal report


Hi , i am creating crystal report with asp.net it is working showing data but  data is of two page its is take round trip action but report is not show 
until again i click on show button in this it is not propersly showing that data is how.

<br />
    <asp:Button ID="btnShow" runat="server" OnClick="btnShow_Click" Text="Show Report" />
<CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="true" DisplayGroupTree="False" EnableDatabaseLogonPrompt="False" /> CrystalReportViewer1.ReportSource = null; SqlCommand cmd = new SqlCommand(strcmd, c.con); SqlDataAdapter da = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); da.Fill(ds); ReportDocument doc = new ReportDocument(); doc.Load(AppDomain.CurrentDomain.BaseDirectory + "\\rptQuotation.rpt"); doc.SetDataSource(ds.Tables[0]); // login info SqlConnectionStringBuilder csb = new SqlConnectionStringBuilder(ConfigurationManager.ConnectionStrings["conStr"].ConnectionString); TableLogOnInfos crtableLogoninfos = new TableLogOnInfos(); TableLogOnInfo crtableLogoninfo = new Tabl

Weird problem in Detailsview - Dropdownlist in



I'm new in this forum and I really hope you'll be able to help me.

I converted a field in the detailsview into a template field and put a dropdownlist in the <InsertItemTemplate> and it worked great. This is the code I put:

<InsertItemTemplate><asp:DropDownList runat="server" DataSourceID="sdsGenresPossible" DataTextField="Genre"  DataValueField="Index" SelectedValue='<%# Bind("Genre") %>' ></asp:DropDownList></InsertItemTemplate>

Now, I tried to do the same thing for the <EditItemTemplate> . This is the code I put there:

<EditItemTemplate><asp:DropDownList runat="server" DataSourceID="sdsGenresPossible" DataTextField="Genre" DataValueField="Index" SelectedValue='<%# Bind("Genre") %>' ></asp:DropDownList></EditItemTemplate>  

When I change the DV properties I do see that a dropdownlist was  added but when I run the program and click on "Edit" in the DV nothing happens (however when I click on "Insert" it works fine).

This is the Select command for the data source I used:

<asp:SqlDataSource runat="server"

Problem with UpdatePanel postback

Hello,I have a Modal Popup window, inside an Update Panel object, that has the following layout:A Title areaA Content area with a tabstrip of 5 tabsA footer area with two buttons (Save and Cancel) and an UpdateProgressIn 3 of the five tabs I have:an UpdatePanel (UpdateMode=Conditional) that wrapsA collection of LinkButtons objectA gridviewAnother Panel object to be showed as a Nested Modal PopupNO update ProgressBoth the link collection and the gridview Select event will open the nested Modal window that contains a custom Usercontrol that is used to add new or edit object of the related gridview like in the code sample below//click handler of the LinkButton protected void btnNewPhone_Click(object sender, EventArgs e) { //Setup properties of the UserControl code omitted // ... //Show the nested Popup this.mpePopupPhone.Show(); } //handler for the gridview selectedIndex event protected void gvPhones_SelectedIndexChanged(object sender, EventArgs e) { //Setup properties of the UserControl code omitted // ... //Show the nested Popup this.mpePopupPhone.Show(); } Please note that: I am using the ModalPopupExtender show/hide behaviors using only server-side code. Also, the ModalPopupExtender objects for nested modal windows does not have the OkControlID & CancelControlID set. As the content of nested modal window is only a single user contro

ASP.Net MVC Dropdownlist and selected value problem

I was able to create a dropdownlist for my MVC project, but the value is not selected as  selected value on the dropdownlist. It just shows whole county list from the first.The value is from database. I tried find it from previous post, but it was quite confusing. Please, suggest me for any idea. Controller Code public ActionResult Edit(int i) {      var items = new SelectList(db.MST_COUNTRies.ToList(), "COUNTRY_ID", "COUNTRY_NM");      ViewData["MST_COUNTRies"] = items; } View Code <p>     <%= Html.DropDownList("COUNTRY_ID", (SelectList)ViewData["MST_COUNTRies"])%> </P>I was able to create a dropdownlist for my MVC project, but the value is not selected as  selected value on the dropdownlist. It just shows whole county list from the first.The value is from database. I tried find it from previous post, but it was quite confusing. Please, suggest me for any idea.Controller Codepublic ActionResult Edit(int i){     var items = new SelectList(db.MST_COUNTRies.ToList(), "COUNTRY_ID", "COUNTRY_NM");     ViewData["MST_COUNTRies"] = items;}View Code<p>    <%= Html.DropDownList("COUNTRY_ID", (SelectList)ViewData["MST_COUNTRies"])%></P>

Problem Binding DropdownList in a gridView to a datasource

I have a Dropdownlist in an itemTemplate in a gridview. My gridView binds to dataTable1 (from which the selected value for dropdown comes from) and dropDown binds to dataTable2 (i need to get DataValueField and DataTextField from here).<asp:TemplateField HeaderText="Category"> <ItemTemplate> <asp:DropDownList ID="Cat" runat="server" SelectedValue='<%#Bind("CATEGORY") %>' > </asp:DropDownList> </ItemTemplate> <FooterStyle BorderStyle="None" /> <HeaderStyle BorderStyle="None" /> <ItemStyle BorderStyle="None" /> </asp:TemplateField>How do I do that? thanks in advance!

Problem with custom onBeginRequest-Handler on client-side when partial postback is triggered from ja

Hi, I have a Modal Dialog with a Ribbon, which starts a long running serverside operation. To inform the user about the progress, I implemented Dino Espositos "Progress Monitor Framework", which worked perfectly (after some work) - at least when I trigger the partial postback from a control inside the UpdatePanel used for displaying the progress. In this approach custom onBeginRequest and onEndRequest-Handlers are used to start and stop displaying the current status of the serverside operation. When I start the operation from a Button on the ribbon by doing "something" with the mentioned control via javascript the serverside operation is started, but my onBeginRequestHandler ist not called and the progress monitor is not "switched on" on the client. Here is what I´m doing in my javascript :  function pageLoad() { progressManager = new VCSharePoint.MultiEdit.Progress(); // Remove existing handlers Sys.WebForms.PageRequestManager.getInstance().remove_beginRequest(onBeginRequest); Sys.WebForms.PageRequestManager.getInstance().remove_endRequest(onEndRequest); // Register handlers for UpdatePanel client events Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(onBeginRequest); Sys.WebForms.PageRequestManager.getInstance().add_endRequest(onEndRequest); } // onBeginRequest() // Called w

Problem binding data to DropDownList in DetailsView

Hi guys. I have a slight issue I awas trying to fix for 2-3 days, but nothing I try works. The scenario: DetailsView control in edit mode, I pass parameters to the SqlDataSourceProducts (edit.aspx?id=2) and the data source selects the appropriate data and fills in the DetailsView form. Except two drop down lists. These two DDLs (DDL2 and DDL3) are dependent on the previous DDL (DDL1) in the DetailsView. Thanks to PeteNet, when the selected value of the DDL1 changes, DDL2 and 3 change their lists and get bound to the database. The problem is: when I edit something from the database, DDL2 and 3 appear empty and when I update any other field and leave these, they get blanked in the database.  My goal is to set the selected value of DDL2 and 3 to the values in the database WHERE ID = QueryStringField="id". I can go for not binding the data unless the field is changed, but does not sound professional and user friendly. code: The SqlDataSource used to select the parameters from the table and populate the DetailsView <asp:SqlDataSource ID="SqlDataSourceProduct" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="SELECT ID, wm_number, upc, check_digit, unit, price_unit, brand, category, shelves, type, cooking, storage, packaging, origin, nutriti

gridview viewstate (size around 1.75Mb on each postback) very serious problem

i am developing a a web application of a general store where the operator has to enter the things what cutomer has purchased..like daily useage item,or anyhing ..so i have form in which i first ask how much item u wanna regsiter...(if he has 20-30 number of items then operator will eneter 20-30 then in gridview 20-30 item are opened...with bind dropdownbox containing name of item ,then textboxs containing mrp,value,stock avail of that item .here is the link for demo... http://iconsoftech.com/mahajan/grid/gridview_test.aspxproblem is suppose the operator enter the value above 20.. then then viewstate size id about 1.50Mb thats too heavey please suggest me solution for this problem..<%@ Page Language="C#" AutoEventWireup="true" CodeFile="gridview_test.aspx.cs" Inherits="gridview_test" %> <!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>Untitled Page</title> </head> <body> <form id="form1" runat="server"> <div> <asp:Label ID="Label4" runat="server" Text="Enter No. Of Products"></asp:Label&g

dropdownlist selected value problem

i have dropdownlist<%= Html.DropDownListFor(model => model.SchoolDistrict,Model.sSchoolDistrict) %>To Poulate this value i have below code in controllerslist = new SelectList(list, "ID", "Name", selected);but what ever selected value i pass didnot shown in ddl

dropdownlist - css - problem chrome


          <asp:Label ID="Label18" runat="server" Text="Vrsta kreditne kartice"></asp:Label></span><span
class="formw"><asp:DropDownList ID="DropDownList2" Selected="True" width="200px" runat="server">
              <asp:ListItem>Diners Club Card</asp:ListItem>

div.row {
  clear: both;
  padding-top: 5px;

div.row span.label {
  float: left;
  width: 175px;
  text-align: left;

div.row span.formw {
  float: left;
  width: 500px;
  text-align: left;
/*  margin:0 0 0 10px;*/


I have a

Dropdownlist posted back html content,firefox alarms "Invalid postback or callback argument"


Ok probably you might have seem a dozens of post's titled "Invalid postback or callback argument" but this one is different.

Application that i am creating is simple content editor using the FCK editor.net Control (the content is HTML Encoded before saving t0 DB and then Decoded back again when displaying). just a simple drawing of of its ui is like this

DdlPages < listing the pages Whose regions/controls value can be edited> Databound

DdlRegions <listing the controls whose content can be edited> Databound on DdlPages selected index change

===========Retreived from DropDownlistRegions selected Index Change===========

txtName <a simple name for the region, user friedly identity >

==> FCK Editor <==

<Save Button> <Discard Button>


I am not such a good designer but hope you understand the UI layout.

This thing works flawless on IE 6,7,8


DropdownlistRegions holds the content to be displayed in the txtName and FckEditor. This is done by forming a custom concatenated column containing the txtName and Fckeditor(HTML content) separated by a ' ^ ' character. and then databound the column to the Dropdownlist value property.

So on selected index chang

prevent postback javascript problem


i have the following example but i get error on GetPostBackEventReference line

value of tpe ...button cannot be converted to....

second question:where should i put this code? do i need just this code and nothing else

how should i for example delay for 20 seconds??

Dim sb As New System.Text.StringBuilder()
            sb.Append("if (typeof(Page_ClientValidate) == 'function') { ")
            sb.Append("if (Page_ClientValidate() == false) { return false; }} ")
            sb.Append("this.value = 'Please wait...';")
            sb.Append("this.disabled = true;")
            Me.btnAddPhotoComment.Attributes.Add("onclick", sb.ToString())



Dropdownlist problem


I have a dropdownlist and a method to handle its selectedIndexChanged event.  When I change the dropdown's selected index and click on a submit button, the selectedIndexChanged event fires as expected.  If I click the again a same selected item second time, the event doesn't fire.


what what was reason I am not getting.. almost 5 hrs spend .. different diffrent ways likse set to selected index set 0 etc.. still it's not getting.


Pls give answers quick

Gridview Dropdownlist databinding problem


I am using gridview, in ItemTemplate  I am using dropdownlist which has the hard-coded value, I want to get updated value of dropdownlist from database, but whenever I use EVAL, it throws the following error:

 'ddl' has a SelectedValue which is invalid because it does not exist in the list of items.

Parameter name: value

I am using the following code:

<asp:TemplateField HeaderText="Status"  >
                      <asp:DropDownList ID="ddl" runat="server" SelectedValue='<%# Bind("Status")%>' >

[Problem] MVC DropDownList Cascading Partial View


Hi, i'm trying to implement a cascading dropdownlist inside a partial view.

this is the code:

js function

function dropDownListCascade() {
    $('#idTipoAntecedente').change(function () {
        $.ajaxSetup({ cache: false });
        var selectedItem = $(this).val();
        if (selectedItem == "" || selectedItem == 0) {
            $("#idAntecedente").attr('disabled', 'enabled');

Dropdownlist postback always select first item


Hello, I am new at Asp.net. I hope some experts can help me.

I have 2 dropdownlist controls (ddl1 and ddl2). When I pick an item from ddl1, it will update ddl2. The problem is when I pick an item in ddl2, it always selects the first item in the list. Is it that the ddl2 autopostback causes the first ddl1 to reload and results the ddl2 to be refreshed also? Or I didn't set something correctly?

thanks in advance.


<asp:DropDownList ID="ddl1" runat="server" DataSourceID="sql

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend