newly added grid view is not displayed during debug [Resolved]

Posted by Suniluc under ASP.NET on 2/6/2013 | Points: 10 | Views : 3790 | Status : [Member] | Replies : 27
i added a new grid view to my aspx page. it is not shown at the time of debug . then i have another problem... i have link button to go to another page.but when i click it page is not loading and it activates validation controls. i have set the causesvalidation attribute to false. why the newly made changes are not shown in the web pages..plz help me

thanks in advance




Responses

Posted by: Ankitsrist on: 2/7/2013 [Member] Starter | Points: 50

Up
0
Down

Resolved
Rebuild ur page by the build menu option at the top

Suniluc, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Oswaldlily on: 2/6/2013 [Member] Starter | Points: 25

Up
0
Down
May i knw how u r binding in gridview...
by setting autogeneratecolumns=false or true?


Suniluc, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Suniluc on: 2/6/2013 [Member] Starter | Points: 25

Up
0
Down
<asp:GridView ID="GridView1" runat="server" AllowSorting="True"
BackColor="White" BorderColor="#CC9966" BorderStyle="None" BorderWidth="1px"
CellPadding="4" DataSourceID="SqlDataSource1" Width="444px"
AutoGenerateColumns="False" DataKeyNames="drcode">
<Columns>
<asp:BoundField DataField="drcode" HeaderText="Code" ReadOnly="True"
SortExpression="drcode" />
<asp:BoundField DataField="drname" HeaderText="Name"
SortExpression="drname" />
<asp:BoundField DataField="drlino" HeaderText="LicenseNo"
SortExpression="drlino" />
<asp:BoundField DataField="drlictgry" HeaderText="Category"
SortExpression="drlictgry" />
</Columns>
<FooterStyle BackColor="#FFFFCC" ForeColor="#330099" />
<HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="#FFFFCC" />
<PagerStyle BackColor="#FFFFCC" ForeColor="#330099" HorizontalAlign="Center" />
<RowStyle BackColor="White" ForeColor="#330099" />
<SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="#663399" />
<SortedAscendingCellStyle BackColor="#FEFCEB" />
<SortedAscendingHeaderStyle BackColor="#AF0101" />
<SortedDescendingCellStyle BackColor="#F6F0C0" />
<SortedDescendingHeaderStyle BackColor="#7E0000" />
</asp:GridView>

Suniluc, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Suniluc on: 2/6/2013 [Member] Starter | Points: 25

Up
0
Down
plz help me...

Suniluc, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ankitsrist on: 2/6/2013 [Member] Starter | Points: 25

Up
0
Down
is your dataset getting fill, post ur code here

Suniluc, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Suniluc on: 2/6/2013 [Member] Starter | Points: 25

Up
0
Down
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using System.Data.SqlClient;
using System.Text;
using System.Windows.Forms;
namespace BVIS
{
public partial class Allocation : System.Web.UI.Page
{
string ctgry;
protected void Page_Load(object sender, EventArgs e)
{
}

protected void btnCncl_Click(object sender, EventArgs e)
{
Response.Redirect("~/Default.aspx");
}

protected void btnSave_Click(object sender, EventArgs e)
{
String connectionString = ConfigurationManager.ConnectionStrings["con"].ToString();
SqlConnection con = new SqlConnection(connectionString);
string sql = "INSERT INTO [tblalloc] (VNo,EmpCode,Drcode,BrCode,Purpose) VALUES (@Val1,@Val2,@Val3,@Val4,@Val5)";
ctgry = RdCtgry.SelectedItem.Value.ToString();

try
{
con.Open();
SqlCommand cmd = new SqlCommand(sql, con);
cmd.Parameters.AddWithValue("@Val1", drpVno.Text.ToString());
cmd.Parameters.AddWithValue("@Val3", drpDrCode.Text.ToString());
cmd.Parameters.AddWithValue("@Val2", drpEmpCode.Text.ToString());
cmd.Parameters.AddWithValue("@Val4", drpBrCode.Text.ToString());
cmd.Parameters.AddWithValue("@Val5", drpPrps.Text.ToString());
cmd.ExecuteNonQuery();

lblMsg.Text = "Insertion Successful";
drpVno.Focus();



}
catch (System.Data.SqlClient.SqlException ex)
{
string msg = "Insert Error:";
msg += ex.Message;
throw new Exception(msg);
}
finally
{
con.Close();
}
}

protected void btnNew_Click(object sender, EventArgs e)
{
lblNew.Visible = true;
txtNew.Visible = true;
btnOk.Visible = true;

}

protected void btnOk_Click(object sender, EventArgs e)
{
drpPrps.Items.Add("txtNew.Text");
lblNew.Visible = false;
txtNew.Visible = false;
btnOk.Visible = false;

}
protected void RdCtgry_SelectedIndexChanged(object sender, EventArgs e)
{
ctgry = RdCtgry.SelectedItem.Value.ToString();

if (ctgry == "Commercial")
{
drpEmpCode.Items.Clear();
drpEmpCode.Enabled = false;
chkDr.Enabled = false;
}
else
{
drpEmpCode.Enabled = true;

}
if (ctgry == "Cars")
{
chkDr.Enabled=true;
}
if (ctgry == "Bikes")
{
drpDrCode.Items.Clear();
drpDrCode.Enabled = false;
}
else
{

drpDrCode.Enabled = true;

}

}

protected void btnUpdt_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection("Data Source=.\\SQLEXPRESS;AttachDbFilename=E:\\vip\\BVIS\\BVIS\\App_Data\\VehicleDb.mdf;Integrated Security=True;User Instance=True");
SqlCommand cmd = new SqlCommand();
cmd.Connection = con;
con.Open();
cmd.CommandText = "UPDATE [tblalloc] SET VNo = @vn, Drcode = @dr, EmpCode= @emp, BrCode=@br, Purpose=@pr WHERE VNo = @vn";

cmd.Parameters.AddWithValue("@vn", drpVno.Text);
cmd.Parameters.AddWithValue("@dr", drpDrCode.Text);
cmd.Parameters.AddWithValue("@emp", drpEmpCode.Text);
cmd.Parameters.AddWithValue("@br", drpBrCode.Text);
cmd.Parameters.AddWithValue("@pr", drpPrps.Text);

cmd.ExecuteNonQuery();
con.Close();
}

protected void chkDr_CheckedChanged(object sender, EventArgs e)
{
if (chkDr.Checked.Equals(false))
{

drpDrCode.Items.Clear();
}


}

protected void Button1_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection("Data Source=.\\SQLEXPRESS;AttachDbFilename=E:\\vip\\BVIS\\BVIS\\App_Data\\VehicleDb.mdf;Integrated Security=True;User Instance=True");
SqlCommand cmd = new SqlCommand();
cmd.Connection = con;
con.Open();
cmd.CommandText = "select * from tblalloc where VNo='" + drpVno.Text.Trim() + "'";
SqlDataReader rdr = cmd.ExecuteReader();
//rdr = cmd.ExecuteReader();
bool temp = false;
while (rdr.Read())
{
drpVno.Text = rdr.GetValue(0).ToString();
drpEmpCode.Text = rdr.GetString(2);
drpDrCode.Text = rdr.GetString(1);
drpBrCode.Text = rdr.GetString(3);
drpPrps.Text = rdr.GetString(4);
temp = true;
}
if (temp == false)
MessageBox.Show("not found");
con.Close();

}

}

}


Suniluc, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Suniluc on: 2/6/2013 [Member] Starter | Points: 25

Up
0
Down
I have two pages with the same problems...newly added controls are not displayed properly....i don't know what to do....

Suniluc, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ankitsrist on: 2/6/2013 [Member] Starter | Points: 25

Up
0
Down
might be it is browser problem change ur browser and run app

Suniluc, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Pavanandey on: 2/6/2013 [Member] Bronze | Points: 25

Up
0
Down
post only the code where you are filling the grid, i could not see that piece there

Thanks
Pavan Kumar
Mark Answer if this fits the need

Suniluc, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Suniluc on: 2/6/2013 [Member] Starter | Points: 25

Up
0
Down
pavan...i am not using code for filling the grid..i am using sql data source property of grid view. my problem is some controls are not displayed when page is loaded...

Suniluc, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ankitsrist on: 2/6/2013 [Member] Starter | Points: 25

Up
0
Down
have u changed ur default browser

Suniluc, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ankitsrist on: 2/6/2013 [Member] Starter | Points: 25

Up
0
Down
i was also facing that same problem nd it got resolved wen i changed my browser

Suniluc, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Suniluc on: 2/6/2013 [Member] Starter | Points: 25

Up
0
Down
Sir,

I am attaching my web pages at design time and in browser.plz check it...i have changed my default browser then also same prob.

regards..
 Download source file

Suniluc, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Suniluc on: 2/6/2013 [Member] Starter | Points: 25

Up
0
Down
plz reply...


Suniluc, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Oswaldlily on: 2/6/2013 [Member] Starter | Points: 25

Up
0
Down
in page load include this

if(!Page.IsPostback)
{

// bind gridview here

}

Suniluc, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ankitsrist on: 2/6/2013 [Member] Starter | Points: 25

Up
0
Down
do one thing place ur gridview in panel control and make its visible property false, and on button click event handler write panel1.visible=true;
may be it work

Suniluc, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ankitsrist on: 2/6/2013 [Member] Starter | Points: 25

Up
0
Down
or once try to connect gridview by code...

Suniluc, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Suniluc on: 2/6/2013 [Member] Starter | Points: 25

Up
0
Down
grid view alone is not the prob..i have a check box...which is not shown.. and a link button which i removed is shown on the page........

Suniluc, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Oswaldlily on: 2/7/2013 [Member] Starter | Points: 25

Up
0
Down

whether ur class inheriting like this



public partial class Tracker : System.Web.UI.Page

Suniluc, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Suniluc on: 2/7/2013 [Member] Starter | Points: 25

Up
0
Down
yes

public partial class Allocation : System.Web.UI.Page


i also tried rebuilding..that also didn't solve the problem..

Suniluc, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ankitsrist on: 2/7/2013 [Member] Starter | Points: 25

Up
0
Down
have u test query while connecting ur gridview control through sql data source property, or the only last option left is to connect gridview nd all with code and put it in
if (!Page.IsPostBack)

{
fillgrid();

}


Suniluc, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ankitsrist on: 2/7/2013 [Member] Starter | Points: 25

Up
0
Down
have u done

Suniluc, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Suniluc on: 2/7/2013 [Member] Starter | Points: 25

Up
0
Down
i tried all these....when i use coding to bind data in grid..it is not working...
now my only prob is when page is loaded it will show old design when i select one of the radio buttons it is show the page properly with controls...

Suniluc, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Suniluc on: 2/7/2013 [Member] Starter | Points: 25

Up
0
Down
thank u all...i think rebuilding has done...so special thanks to ankit.

Suniluc, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ankitsrist on: 2/7/2013 [Member] Starter | Points: 25

Up
0
Down
my pleasure sunil, if u mark my answer so that it will be very helpful for others :)

Suniluc, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Hariinakoti on: 2/7/2013 [Member] Starter | Points: 25

Up
0
Down
@Suniluc,
Please Create new pages and paste this code.I think some files are missing in that pages.Try like this

Thanks & Regards
Hari

Suniluc, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Suniluc on: 2/7/2013 [Member] Starter | Points: 25

Up
0
Down
k...hari..i will try that

Suniluc, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response