Advertise with us
Control Panel
Forum
Hosting Help
ASP.NET 4.5 & SQL 2012 Hosting
Resources
Notice
Login
Members
Shared Hosting
|
Upgrade
|
Advertise
|
Tutorials
|
Home
»
Questions & Answers
»
gridview pagination error when fill dropdownlist on page_load event
gridview pagination error when fill dropdownlist on page_load event
03 Aug, 11
Author:
Leonardo Glejberman Tuchman
Dear friends
Like Socrates only i know i do not know nothing
See my code and tell me please what i'm doing wrong on page_load
From the moment i put the code to fill the dropdownlists, the dropdownlists are filled but the grid view pagination is break
Someone with more asp net experience can tell me what can i do ?
page
http://aspspider.info/leoglej/busqueda.aspx
> %@ page language=C# masterpagefile=./Side.master %
script runat=server
void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
//System.Data.SqlClient.SqlConnection sqlConnection = new System.Data.SqlClient.SqlConnection(System.Configuration.ConfigurationManager.AppSettings[TestLeonardo]);
//sqlConnection.Open();
//System.Data.SqlClient.SqlCommand sqlCommand = new System.Data.SqlClient.SqlCommand(SELECT * FROM Zona, sqlConnection);
//System.Data.SqlClient.SqlDataAdapter Adapter = new System.Data.SqlClient.SqlDataAdapter(sqlCommand.CommandText, sqlConnection);
//System.Data.DataSet ds = new System.Data.DataSet();
//Adapter.Fill(ds);
//this.ddlZona.DataSource = ds;
//this.ddlZona.DataValueField = key;
//this.ddlZona.DataTextField = Zona;
//this.ddlZona.DataBind();
//System.Data.SqlClient.SqlCommand sqlCommand2 = new System.Data.SqlClient.SqlCommand(SELECT * FROM TipoInmueble, sqlConnection);
//System.Data.SqlClient.SqlDataAdapter Adapter2 = new System.Data.SqlClient.SqlDataAdapter(sqlCommand2.CommandText, sqlConnection);
//System.Data.DataSet ds2 = new System.Data.DataSet();
//Adapter2.Fill(ds2);
//this.ddlTipo.DataSource = ds2;
//this.ddlTipo.DataValueField = key;
//this.ddlTipo.DataTextField = TipoInmueble;
//this.ddlTipo.DataBind();
//sqlConnection.Close();
Page.DataBind();
}
}
protected void Button1_Click1(object sender, EventArgs e)
{
Response.Redirect(
http://aspspider.info/leoglej/busqueda.aspx
);
}
/script
asp:content id=Content1 contentplaceholderid=AreaAutomatica runat=server
table align=center border=0
form id=form1 method=get action=busqueda.aspx runat=server
tr
td align=center
Zona
asp:DropDownList ID=ddlZona runat=server AutoPostBack=True
/asp:DropDownList
Tipo
asp:DropDownList ID=ddlTipo runat=server AutoPostBack=True
/asp:DropDownList
asp:CheckBox ID=cbRenta runat=server Text=Renta /
asp:CheckBox ID=cbVenta runat=server Text=Venta /br /
br /
br /
asp:Button ID=Button1 runat=server backcolor = bisque OnClick=Button1_Click1 Text=Buscar /
/td
/tr
tr
td align=center
asp:GridView PageSize=3 width=400 AllowPaging=true DataSourceID=SqlDataSource1 ID=GridView1 AutoGenerateColumns=False runat=server
BorderWidth=0px BackColor=White CellPadding=3 BorderStyle=None
BorderColor=White Font-Names=Arial
FooterStyle ForeColor=black BackColor=bisque/FooterStyle
PagerStyle ForeColor=black BackColor=bisque HorizontalAlign=Center/PagerStyle
HeaderStyle ForeColor=black Font-Bold=True
BackColor=bisque/HeaderStyle
Columns
asp:ImageField DataImageUrlField=Imagen/asp:ImageField
asp:BoundField HeaderText=Inmobiliaria DataField=Inmobiliaria /asp:BoundField
asp:BoundField HeaderText=Tipo DataField=Tipo /asp:BoundField
asp:BoundField HeaderText=Precio DataField=Precio /asp:BoundField
/Columns
SelectedRowStyle ForeColor=black Font-Bold=True
BackColor=#669999/SelectedRowStyle
RowStyle ForeColor=black/RowStyle
/asp:GridView
/form
/td
/tr
/table
asp:SqlDataSource ID=SqlDataSource1 runat=server ConnectionString=%$ ConnectionStrings:TestLeonardo %
SelectCommandType=StoredProcedure
SelectCommand=spPrimerBusqueda
/asp:SqlDataSource
/form
/asp:content
Thanks in advance!!!
Answers .............
Author:
Nishanth Mohan
Posted Date: 04 Aug, 11
<A href=
http://visitlondon.brinkster.net/>change
your form method to POST instead of GET.
GET will pass everything in URL and URL has a limit, thats what the error says.</a>
Author:
Nishanth Mohan
Posted Date: 04 Aug, 11
http://visitlondon.brinkster.net
change
your form method to POST instead of GET.
GET will pass everything in URL and URL has a limit, thats what the error says.
http://visitlondon.brinkster.net
Author:
Leonardo Glejberman Tuchman
Posted Date: 04 Aug, 11
Thanks!!!
I did many projects with asp 3.0 and i knew the issue
but i feel that asp net is magic...that's my problem
Again thanks
Now i'll research again the stored procedure managment dynamic and with parameters,is the core of the system
I must learn exactly how to work perfectly with asp net and sp,sure i'll have more posts about it
Leonardo
You must
login
to post answer for this question.
Total
members
:
250805
Average new registrations per day (in last 7 days):
10
New Registration:
Open
Register Now
Talk to Webmaster
Tony John
Facebook
Google+
Twitter
Advertise
Privacy Policy
Terms of use
Contact Us
SpiderWorks Technologies Pvt Ltd.
All Rights Reserved.