c# - DropDownList in fixed -


i have dropdownlists in particular screen , whenever value of same, comes first value. do solve this, dropdownlist in other pages work correctly , can select value of them, can not.

i'm setting values ​​of dynamically, every time go file in server folder, upgraded, filling vector has name (in string) of items in directory. when select different value comes standard on it, quyando'll play value in database, if had not selected anything. i've tried solve autoporsback true , false, , nothing in page_load. how fix this? have no errors in code.

note: drop down list loaded every time climb new file, not have in ispostback. every time climb new file, have method mostraimagenscarrefadas() updates , populates dropdownlist. method gets event of button. not using update panel , nothing of sort.

all code component:

 //aspx header <%@ page title="" language="c#" masterpagefile="~/administrativo/masterpage.master"    enableviewstate="false" autoeventwireup="true" codefile="cadastroimovel.aspx.cs" inherits="administrativo_cadastroimovel" %>  //dropdownlist in aspx <div class="span2"> <div> <asp:dropdownlist id="ddlimgprincipal" runat="server" width="160px" autopostback="false" onselectedindexchanged="ddlimgprincipal_selectedindexchanged"> </asp:dropdownlist>  </div> </div>  // method page_load protected void page_load(object sender, eventargs e) {      if (!ispostback)     {      } }   //where try value of dropdownlist protected void btsalvar_click(object sender, eventargs e) {     eimoveis imovel = new eimoveis();      imovel.area_total = txtarea.text;     imovel.bairro = txtbairro.text;     imovel.banheiro = txtbanheiro.text;     imovel.cep = txtcep.text;     imovel.cidade = ((system.web.ui.webcontrols.listcontrol)     (ddlcidade)).selectedvalue.tostring();     imovel.codcliente = ((system.web.ui.webcontrols.listcontrol)    (ddlproprietario)).selectedvalue.tostring();     imovel.codtipoimovel = ((system.web.ui.webcontrols.listcontrol)    (ddlcategoriaimovel)).selectedvalue.tostring();     imovel.complemento = txtcomplemento.text;     imovel.descricao = txtdescricao.text;     imovel.garagem = txtvagasgaragem.text;     imovel.nome = txtnome.text;     imovel.numero = txtnúmero.text;     imovel.quarto = txtquartos.text;     imovel.referencia = txtreferencia.text;     imovel.rua = txtrua.text;     //imovel.suite = sui     imovel.valor = txtvalor.text;      if (manimovel.insere(imovel))     {         eimagens imagem = new eimagens();         manimagem manimg = new manimagem();          list<string> files = new manfile().getlistfilesfordirectory(this, mae.diretorio_temp_img);          datatable dt = manimovel.getlastid(imovel);          datarow row = dt.newrow();          string codigo = dt.rows[0].itemarray[0].tostring();          int tamanho = 0;                      if (files != null)         {             foreach (string str in files)             {                 imagem.cdimovel = codigo;                 imagem.imagem = str;                   if (ddlimgprincipal.selecteditem != null)                 {                     if (ddlimgprincipal.selecteditem.tostring() == str)                     {                         imagem.imagemprincipal = "sim";                      }                 }                   if (manimg.insere(imagem))                 {                     tamanho++;                 }                  //tamanho++;             }         }          if (tamanho == files.count)         {             if (new manfile().copiatodososarquivos(this, mae.diretorio_temp_img,     mae.diretorio_img))             {                 if (new manfile().deletatodosarquivos(this, mae.diretorio_temp_img))                 {                     montaliteralcarrossel();                  }             }         }     } }  //here fill dropdownlist public void mostraimagenscarrefadas() {     list<string> files = new manfile().getlistfilesfordirectory(this, mae.diretorio_temp_img);      ddlimgprincipal.items.clear();      if (files != null)     {         foreach (string item in files)         {             ddlimgprincipal.items.add(new listitem(item));         }     } } 


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -