Forms Data Controls :: Error - Gridview Fired Event "Sorting" Which Wasn't Handled Using Visual Studio 2008

Feb 21, 2010

I have a gridview in an update panel which is declared in an ASPX page, and bound to a SQLDataSource in code. The gridview's 'allowsorting' attribute is set to true, and because it is bound to a SQLDataSource, I expect the sorting to be automatically handled.

Yet I am getting the "Message: Sys.WebForms.PageRequestManagerServerErrorException: The GridView 'grdStatusItems' fired event Sorting which wasn't handled" error. I am using Visual Studio 2008, IE8, IIS7. What am I doing wrong? I have done anextensive search for this error, but it seems in most cases where this error occurs, the people are not using a SQLDatasource, so have to handle the sorting event themselves. Is this the case here? Here is the updatepanel and gridview declaration in the aspx file:

[Code]....

View 1 Replies


Similar Messages:

Forms Data Controls :: The GridView "GridView1" Fired Event Sorting Which Wasn't Handled

Mar 23, 2010

I googled and found this post : [URL] I have never had this problem b4. I just started a new job, do i need a service pack update or something?

DataTable dt;
DbCommand cmd = GenericDataAccess.CreateCommand_SP("rptPlannedActivity");
GenericDataAccess.AddParameter(cmd, "@Outstanding", DbType.Int16, 1);
GenericDataAccess.AddParameter(cmd, "@Period", DbType.Int16, 45);
dt = GenericDataAccess.ExecuteSelectCommand(cmd);
GridView1.DataSource = dt ;
GridView1.DataBind();

View 3 Replies

Forms Data Controls :: Default Sort "The GridView "GridView1" Fired Event Sorting Which Wasn't Handled

Feb 19, 2010

I have a page displays CRM data (with CrmService) in GridView. Everything run ok until I tried to sort out one field by default and I received the following exception: The GridView 'GridView1' fired event Sorting which wasn't handled. The reason I am using GridView to do the sorting because:

1) Cannot do it with SQL "ORDER BY" since date retrieval from CRM Web Service

2) Cannot use OrderExpression for QueryExpression from CRM because the column I want to sort is generated by my algorithm

GridView1.Sort("ColumnName" SortDirection.Descending);
in Page_Load, or Button1_Sort(object sender, GridViewSortEventArgs e), they all trigger the above execption!

I also added the method to the following method to handle exception, but didn't work:

protected void GridView1_Sorting(object sender, GridViewSortEventArgs e)
{
GridView1.Sort("ColumnName" SortDirection.Descending);
}

View 2 Replies

Forms Data Controls :: The Gridview Fired Event RowEditing Which Wasn't Handled

Aug 5, 2010

I've got a gridview that returns student order history which works just fine. It pulls the StudentId from a hidden field on page load. I have a link button that ADDS AN ORDER when clicked. It calls a stored procedure, inserts the record, then rebinds the gridview and displays the new record at the top of the list.

Problem is when I go to EDIT it, i get this error... "The GridView 'GridViewOrderHistory' fired event RowEditing which wasn't handled." But the interesting thing is the error doesn't occur if I close the browser and reload the page and then click on that new record that was created. Obviously I'm missing something in my code when the new order is created. Here are the 2 subs involved in the process.

[Code]....

View 8 Replies

Data Controls :: GridView 1 Fired Event Row Deleting Which Wasn't Handled

Dec 26, 2012

i have a problem in my gridview control,actually i am having a gridview and bind the gridview with the database,in that gridview i provide a link button called delete,when i click the delete button its shows an error,after reloading the page the current record is deleted,but whenever the delete button is pressed its shows the following error..The GridView 'GridView1' fired event RowDeleting which wasn't handled.but whenever i reload the project the record will be deleted,here is my code

<asp:GridView runat="server" AutoGenerateColumns="false" ID="GridView1"> <Columns>  
<asp:BoundField DataField="empname" HeaderText="EMPLOYEE NAME"  SortExpression="empname" />   
<asp:TemplateField> <ItemTemplate>                   
<asp:LinkButton runat="server" ID="lnkDelete" Text="Delete" CommandName="delete"     

[code]....

View 1 Replies

Forms Data Controls :: Update Record - Gridview Fired Event RowEditing Which Wasn't Handled

Dec 20, 2010

I am populating the gridview on the basis of listbox selection . However, I am setting the datasource in the click event after listbox entry. When i am trying to update any record in the gridview this error gets thrown because the datasourceid from the aspx page has been removed. Code for reference -

protected void btn_save_Click(object sender, EventArgs e)
{
ArrayList list = new ArrayList();
foreach (object o in ListBox2.Items)
{
list.Add(o);
}
string str2 = null, str, host;
string str1 = "SELECT SYSTEMNAME, DATETIME, PDOWNTIME, UDOWNTIME, SYSDOWNMINS, REASON FROM PLANNED_DOWNTIME where ";
host = Convert.ToString(list[0]);
str2 = " ( SYSTEMNAME like '" + host + "'";
for (int i = 1; i < list.Count; i++)
{
host = Convert.ToString(list[i]);
str2 = str2 + " or SYSTEMNAME LIKE'" + host + "'";
}
str = str1 + str2 + " )";
string connectstring = "Data Source=SRCPA035\ovops;Initial Catalog=reporter;Persist Security Info=True;User ID=sa;Password=ril123";
DataTable dt = new DataTable();
SqlConnection connection = new SqlConnection(connectstring);
try
{
connection.Open();
SqlCommand sqlCmd = new SqlCommand(str, connection);
SqlDataAdapter sqlDa = new SqlDataAdapter(sqlCmd);
sqlDa.Fill(dt);
if (dt.Rows.Count > 0)
{
GridView1.DataSource = dt;
GridView1.DataBind();
}
GridView1.DataSource = SqlDataSource1;
}
catch (System.Data.SqlClient.SqlException ex)
{
string msg = "Fetch Error:";
msg += ex.Message;
throw new Exception(msg);
}
finally
{
connection.Close();
}
}

View 6 Replies

Forms Data Controls :: GridView1 Fired Event PageIndexChanging Which Wasn't Handled

Feb 8, 2011

GridView1 fired event PageIndexChanging which wasn't handled

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class View_Project : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Session["USERNAME"] == null)
{
Response.Redirect("Home.aspx");
}
}
protected void Button1_Click(object sender, EventArgs e)
{
fillgrid();
}
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
GridView1.PageIndex = e.NewPageIndex;
fillgrid();
}
private void fillgrid()
{
if (TextBox1.Text == "*")
{
SqlCommand cmd;
SqlConnection con = new SqlConnection("Data Source=SUNTECH-812ECD7\SQLEXPRESS;Initial Catalog=suntech;Integrated Security=True;");
cmd = new SqlCommand("Select * from " + DropDownList3.SelectedItem + " where project_name like '" + TextBox1.Text + "'");
con.Open();
cmd.Connection = con;
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
GridView1.DataSource = ds;
GridView1.DataBind();
con.Close();
}
else
{
SqlCommand cmd;
SqlConnection con = new SqlConnection("Data Source=SUNTECH-812ECD7\SQLEXPRESS;Initial Catalog=suntech;Integrated Security=True;");
cmd = new SqlCommand("Select * from " + DropDownList3.SelectedItem + " where project_name like '" + TextBox1.Text + "'");
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
GridView1.DataSource = ds;
GridView1.DataBind();
con.Close();
}
}
}

View 4 Replies

Forms Data Controls :: The GridView "gridData" Fired Event PageIndexChanging Which Wasn't Handled

Feb 11, 2011

I Read This [URL] but when i click next page mygird be Empty and blank

<asp:GridView ID="grdData" runat="server" AutoGenerateColumns="False" GridLines="None"

View 1 Replies

Forms Data Controls :: GridView1 On First Page Fired Event PageIndexChanging Which Wasn't Handled

Feb 8, 2011

I am getting this error when click on page no 2 of grid view on first page it is working correctly My source code of grid view is

<asp:GridView ID="GridView1" runat="server" Width="738px" CellPadding="4" ForeColor="#333333" AllowPaging="True" >
<RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
<FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
<HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
And c# code is
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class Time_keeping_system : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
private void Page_PreInit(object sender, EventArgs e)
{
if (Session["USERNAME"] == null)
{
this.MasterPageFile = "MasterPage.master";
}
else
{
this.MasterPageFile = "MasterPage2.master";
}
}
protected void Calendar1_SelectionChanged(object sender, EventArgs e)
{
//TextBox1.Text = Calendar1.SelectedDate.ToShortDateString();
TextBox1.Text = Calendar1.SelectedDate.ToString("dd/MM/yyyy");
}
protected void Button1_Click(object sender, EventArgs e)
{
if (TextBox1.Text == "*")
{
SqlCommand cmd;
SqlConnection con = new SqlConnection("Data Source=SUNTECH-812ECD7\SQLEXPRESS;Initial Catalog=suntech;Integrated Security=True;");
cmd = new SqlCommand("select ld.username, ld.login_date,ld.login_time,wp.Project_Id,wp.Project_Of,wp.Project_Name,wp.Start_time,wp.end_time, bd.break_for,bd.break_time,bd.break_over_time,l.logout_time from login_details ld inner join working_projects
wp on ld.login_date= wp.Date join break_details bd on ld.login_date = bd.login_date join logout l on bd.login_date= l.logout_date where ld.username ='" + DropDownList1.SelectedValue + "'");
//cmd = new SqlCommand("Select * from " + DropDownList3.SelectedItem + " where project_name like ''" + TextBox1.Text + "''");
//cmd.ExecuteNonQuery();
con.Open();
cmd.Connection = con;
//SqlDataReader reader = cmd.ExecuteReader();
//GridView1.DataSource = reader;
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
GridView1.DataSource = ds;
GridView1.DataBind();
con.Close();
// reader.Close();
}
else
{
SqlCommand cmd;
SqlConnection con = new SqlConnection("Data Source=SUNTECH-812ECD7\SQLEXPRESS;Initial Catalog=suntech;Integrated Security=True;");
cmd = new SqlCommand("select ld.username, ld.login_date,ld.login_time,wp.Project_Id,wp.Project_Of,wp.Project_Name,wp.Start_time,wp.end_time, bd.break_for,bd.break_time,bd.break_over_time,l.logout_time from login_details ld inner join working_projects
wp on ld.login_date= wp.Date join break_details bd on ld.login_date = bd.login_date join logout l on bd.login_date= l.logout_date where ld.username = '" + DropDownList1.SelectedValue + "' AND ld.login_date = '" + TextBox1.Text + "'");
//cmd = new SqlCommand("Select * from " + DropDownList3.SelectedItem + " where project_name like ''" + TextBox1.Text + "''");
//cmd.ExecuteNonQuery();
con.Open();
cmd.Connection = con;
//SqlDataReader reader = cmd.ExecuteReader();
//GridView1.DataSource = reader;
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
GridView1.DataSource = ds;
GridView1.DataBind();
con.Close();
// reader.Close();
}
}
protected void TextBox1_TextChanged(object sender, EventArgs e)
{
}
}

View 10 Replies

Cancel Row In Grid View The GridView 'GridView1' Fired Event RowCancelingEdit Which Wasn't Handled?

Oct 27, 2010

this error apear when I try to cancel row in grid view The GridView 'GridView1' fired event RowCancelingEdit which wasn't handled

View 3 Replies

Forms Data Controls :: Why Wasn't GridView's RowDataBound Event Fired

Apr 21, 2010

Why wasn't my GridView's RowDataBound event fired? I have a masterpage on whick i have a query button, and I have a content page on which i have a customized GridView(named cgvEmployees,derived from GridView). The logic is when user click the button, the button click event triggered that search the underlying database and populate the GridView.

Everything runs great except that RowDataBound event isn't triggered. Because I have to change some cells' representations in RowDataBound event handler. I have surfed so much pages to find the answer but failed. Below is what i have already done:

1. set the autoeventwireup to true;
2. i have a cgvEmployees.bind() sentence in the button click event handler;
3. i have OnRowDataBound="cgvEmployees_OnRowDataBound" in the content page GridView tag attribute

by the way, the database query is coded by Linq Dynamic Query (please google 'dynamic Linq').

void Master_QueryButton_Click(object sender, EventArgs e)
{
RetiredEmployeeDataContext db = new RetiredEmployeeDataContext();
NameValueCollection nvcQueryKeyValue = getNVCQueryKeyValue();
Expression<Func<RetiredEmployee, bool>> searchPredicate = getLambdaExpr(nvcQueryKeyValue);
IQueryable<RetiredEmployee> retireds = db.RetiredEmployees;
Expression expr = Expression.Call(typeof(Queryable), "Where",
new Type[] { typeof(RetiredEmployee) }, Expression.Constant(retireds), searchPredicate);
IQueryable<RetiredEmployee> query = db.RetiredEmployees.AsQueryable().Provider.CreateQuery<RetiredEmployee>(expr);
List<RetiredEmployee> employeeList = new List<RetiredEmployee>(query);
List<RetiredEmployeeEO> employees = new List<RetiredEmployeeEO>();
foreach (RetiredEmployee employee in employeeList)
{
RetiredEmployeeEO employeeEO = new RetiredEmployeeEO();
employeeEO.MapEntityToProperties(employee);
employees.Add(employeeEO);
}
cgvEmployees1.ListClassName = typeof(RetiredEmployeeEOList).AssemblyQualifiedName;
cgvEmployees1.LoadMethodName = "LoadFromQuery";
cgvEmployees1.LoadMethodParameters.Clear();
cgvEmployees1.LoadMethodParameters.Add(employees);
cgvEmployees1.DataBind();
}
protected void cgvEmployees1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
//Add the edit link to the action column.
HyperLink editLink = new HyperLink();
if (((BasePage)this.Page).ReadOnly)
{
editLink.Text = "View";
}
else
{
editLink.Text = "Edit";
}
editLink.NavigateUrl = "employee.aspx" + EncryptQueryString("id=" + ((RetiredEmployeeEO)e.Row.DataItem).ID.ToString());
if(e.Row.Cells[0].Controls.Count==0)
e.Row.Cells[0].Controls.Add(editLink);
//Add checkbox to display the isactive field.
CheckBox chkActive = new CheckBox();
chkActive.Checked = ((RetiredEmployeeEO)e.Row.DataItem).liveOrDead;
chkActive.Enabled = false;
if(e.Row.Cells[24].Controls.Count==0)
e.Row.Cells[24].Controls.Add(chkActive);
if (((RetiredEmployeeEO)e.Row.DataItem).gender.Equals((byte)1))
e.Row.Cells[2].Text = "Male";
else
e.Row.Cells[2].Text = "Female";
if (((RetiredEmployeeEO)e.Row.DataItem).retiredOr.Equals((byte)1))
e.Row.Cells[14].Text = "Retired1";
else
e.Row.Cells[14].Text = "Retired2";
if (((RetiredEmployeeEO)e.Row.DataItem).birthday.Equals("1753-01-01"))
e.Row.Cells[3].Text = "";
if (((RetiredEmployeeEO)e.Row.DataItem).dayToEmployed.Equals("1753-01-01"))
e.Row.Cells[6].Text = "";
if (((RetiredEmployeeEO)e.Row.DataItem).dayRetired.Equals("1753-01-01"))
e.Row.Cells[7].Text = "";
if (((RetiredEmployeeEO)e.Row.DataItem).dayParty.Equals("1753-01-01"))
e.Row.Cells[13].Text = "";
if (((RetiredEmployeeEO)e.Row.DataItem).daytoassign.Equals("1753-01-01"))
e.Row.Cells[17].Text = "";
}
}

View 22 Replies

Forms Data Controls :: Gridview Inside Another Gridview Both Sorting - Using 3.5 Visual Studio 2008 C# Code Behind

Apr 16, 2010

I have the gridview inside another gridview, i want to sort that both gridviews, I don't know how to achieve using asp.net 3.5 visual studio 2008 c# code behind. Following are my aspx page,

<div
id="divclm"
runat="server">
<asp:GridView
ID="claimgrid"
runat="server"
AutoGenerateColumns="False" AllowSorting="True"
Width="100%"
AllowPaging="True"
CssClass="gareahead"
EmptyDataText="No Records To Display"
OnRowDataBound="claimgrid_RowDataBound"
OnRowCreated="claimgrid_RowCreated"
GridLines="Both"
OnPageIndexChanging="claimgrid_PageIndexChanging"
OnSorting="claimgrid_Sorting"
CaptionAlign="Right">
<Columns>
<asp:HyperLinkField
Text="<img id='upimg' src='Styles/Images/appschg.gif'/>"
ItemStyle-Width="10px">
<ItemStyle
Width="10px"
/>
</asp:HyperLinkField>
<asp:BoundField
DataField="name"
HeaderText="Name"
SortExpression="name">
<HeaderStyle
HorizontalAlign="Center"
/>
<ItemStyle
HorizontalAlign="Left"
/>
</asp:BoundField>
<asp:BoundField
DataField="code"
HeaderText="Code"
SortExpression="code">
<HeaderStyle
HorizontalAlign="Center"
/>
<ItemStyle
HorizontalAlign="Left"
/>
</asp:BoundField>
<asp:TemplateField>
<ItemTemplate>
</td></tr>
<tr>
<td
colspan="6"><div
id="<%#Eval("code") %>"
style="display:none;position:relative">
<asp:GridView
ID="Gdclmline1"
runat="server"
AllowPaging="True"
AllowSorting="True"
AutoGenerateColumns="False"
OnSorting="Gdclmline1_Sorting" BorderColor="Green"
BorderStyle="Solid"
BorderWidth="1px"
OnRowDataBound="Gdclmline1_RowDataBound"
OnRowEditing="Gdclmline1_RowEditing" Font-Names="Verdana"
Font-Size="8pt"
Font-Strikeout="False"
OnSelectedIndexChanging="Gdclmline1_SelectedIndexChanging"
OnRowUpdating="Gdclmline1_RowUpdating" PageSize="1000"
RowStyle-Wrap="false"
Width="100%"
CssClass="gareahead"
EmptyDataText="No Records To Display"
GridLines="Both">
<PagerSettings
Mode="NextPreviousFirstLast"
NextPageText="Next"
Position="Top"
PreviousPageText="Prev"
/>
<Columns>
<asp:TemplateField
HeaderText="phone"
SortExpression="phone">
<HeaderStyle
HorizontalAlign="Center"
/>
<ItemStyle
HorizontalAlign="Left"
/>
<ItemTemplate>
<asp:Label
ID="lblphone"
runat="server"
Text='<%#Bind("phone") %>'> </asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField
HeaderText="address1"
SortExpression="address2">
<HeaderStyle
HorizontalAlign="Center"
/>
<ItemStyle
HorizontalAlign="Left"
/>
<ItemTemplate>
<asp:Label
ID="lbladdress1
runat="server"
Text='<%#Bind("address1") %>'> </asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<RowStyle
CssClass="gr"
Height="100px"
HorizontalAlign="Left"
Wrap="true"/>
<SelectedRowStyle
CssClass="gr"
/> <PagerStyle
CssClass="gareahead"
HorizontalAlign="Left"
Wrap="False"
/> <HeaderStyle
CssClass="ghead"
ForeColor="White"
Wrap="true"
/> </asp:GridView>
</div>
</td>
</tr>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<PagerSettings
Mode="NextPreviousFirstLast"
NextPageText="Next"
Position="Top"
PreviousPageText="Prev"
/>
<HeaderStyle
HorizontalAlign="Center"
VerticalAlign="Middle"
CssClass="ghead"
ForeColor="White"
/>
<RowStyle
CssClass="gr"
/>
<SelectedRowStyle
CssClass="gs"
/>
</asp:GridView>
</div>

that aspx page contains gridview that contain one more gridview inside in it.Now i want to sort out both the grid i.e)claimgrid and Gdclmline1 i want code in c#.

View 3 Replies

Forms Data Controls :: Gridview Fired Sorting Event Without Handle On Statement "helper.ApplyGroupSort()

Jan 25, 2010

I have problem with gridview sorting. I am using online example to sort a grid view. see the link [URL] but I always got an error "The gridview fired sorting event without handle" on this statement "helper.ApplyGroupSort();"

<table width="100%">
<tr>
<td colspan=3><asp:Label id="category_name" Runat="server"
ForeColor="#ff0000" Font-Bold=true /></td>
</tr>
<tr>
<td colspan="3" align="center" width="100%">
<asp:GridView ID="dg_drawings"
runat="server" AutoGenerateColumns="False" EnableViewState="False" CellPadding="5" CellSpacing="0" Width="90%"
>
<Columns>
<asp:BoundField DataField="Description"
SortExpression="Description" />
<asp:BoundField DataField="sub_description"
SortExpression="sub_description" />
<asp:BoundField DataField="drawing_id" InsertVisible="False"
ReadOnly="True"
SortExpression="drawing_id" />
<asp:BoundField DataField="DRAWING_DESCRIPTION"
SortExpression="DRAWING_DESCRIPTION" />
<asp:BoundField DataField="DWG_URL" SortExpression="DWG_URL" />
</Columns>
</asp:GridView>
</td>
</tr>
</table>

Here is my C# code

public partial class listDrawings : System.Web.UI.Page
{
admin _admin = new admin();
private GridViewHelper helper;
int categoryid = 0;
protected void Page_Load(object sender, EventArgs e)
{
if (Convert.ToString(Session["logged_in"]) == "1")
{
ph_header.Controls.Add(LoadControl("../controls/builder_header.ascx"));
}
else
{
ph_header.Controls.Add(LoadControl("../controls/header.ascx"));
}
/*if (Convert.ToString(Session["details_hit"]) != "1")
{
_admin.add_page_hit("Standard Details");
Session.Add("details_hit", "1");
}
*/
string categoryidStr = Request.QueryString["categoryid"];
string category = Request.QueryString["category"];
//int categoryid = 0;
if (categoryidStr != null)
{
categoryid = Convert.ToInt32(categoryidStr);
}
category_name.Visible = true;
category_name.Text = category + " Drawing Details";
get_category_drawings(categoryid);
}
protected void get_category_drawings(int categoryid)
{
OracleConnection myConn;
OracleCommand myCmd;
if (categoryid == 3)
{
myConn = new OracleConnection(ConfigurationManager.AppSettings.Get("oracle"));
myCmd = new OracleCommand("DRAWINGS.GET_STAR_SUB_DRAWINGS");
myCmd.CommandType = CommandType.StoredProcedure;
myCmd.Connection = myConn;
myCmd.Parameters.Add(new OracleParameter("iCATEGORY", OracleDbType.Int32, ParameterDirection.Input)).Value = categoryid;
myCmd.Parameters.Add(new OracleParameter("iSUB_CATEGORY", OracleDbType.Int32, ParameterDirection.Input)).Value = 0;
myCmd.Parameters.Add(new OracleParameter("oDRAWINGS", OracleDbType.RefCursor, ParameterDirection.Output));
}
else
{
myConn = new OracleConnection(ConfigurationManager.AppSettings.Get("oracle"));
myCmd = new OracleCommand("DRAWINGS.GET_STAR_DRAWINGS");
myCmd.CommandType = CommandType.StoredProcedure;
myCmd.Connection = myConn;
myCmd.Parameters.Add(new OracleParameter("iCATEGORY", OracleDbType.Int32, ParameterDirection.Input)).Value = categoryid;
myCmd.Parameters.Add(new OracleParameter("oDRAWINGS", OracleDbType.RefCursor, ParameterDirection.Output));
}
try
{
myConn.Open();
this.dg_drawings.DataSource = myCmd.ExecuteReader();
dg_drawings.DataBind();
helper = new GridViewHelper(this.dg_drawings);
string[] cols = new string[2];
cols[0] = "Description";
cols[1] = "sub_description";
helper.RegisterGroup(cols, true, true);
helper.ApplyGroupSort();
}
catch (OracleException ex)
{
if (categoryid == 3)
{
_admin.send_email("resources/listDrawings.aspx", "DRAWINGS.GET_STAR_SUB_DRAWINGS", ex.Message);
}
else
_admin.send_email("resources/listDrawings.aspx", "DRAWINGS.GET_STAR_DRAWINGS", ex.Message);
Response.Redirect("~/error.aspx");
}
finally
{
myCmd.Dispose();
myConn.Close();
myConn.Dispose();
}
}
}

View 5 Replies

Forms Data Controls :: GridView , ASP.net 3.5 And Visual Studio 2008?

Apr 4, 2010

I have in my laptop VS 2003, VS 2005 and VS 2008. I am making some SMS application in which I am using some DLL which need asp.net 3.5 so I am making application VS 2008. Now in my application I am using DAL and BLL method where in I am making .xsd file with TableAdapted from that I am making BLL files.

I added Formview in my aspx page configure it with Objectdatasource . IDE was not invoking the wizard for objectdatasource after lot finding. I got from some forum that after removing bin folder from application. It will start working. This was the first problem now I add gridview in my aspx page now and configure with Object data source. But when I go property builder of gridview I cannot see Edit Template, I can see only Empty template and Pager Template. Here my question this is new in VS 2008 as when i was working with VS 2005 I could see all Template. Next thing when change anything through property builder, I can see changes in the design view mode but I cannot see any changes in HTML source view. Again when I switch back to HTML source view to design mode all changes will go away. Why is it so !! For more info I will put my aspx, aspx.vb page code here.

[Code]....

View 1 Replies

Forms Data Controls :: Can Visual Studio 2008 Gridview Control Do Grouping

Mar 1, 2010

Can Visual Studio 2008 Gridview control do grouping? And how?

View 1 Replies

DataSource Controls :: Error When Using Inbuilt Data Connection In Visual Studio 2008?

Jul 11, 2010

Failed to generate a user instance of SQL Server due to failure in retrieving the user's local application data path. make sure the user has a local user profile on the computer. The connection will be closed.

View 1 Replies

Forms Data Controls :: GridView's RowDataBound Event Fired Twice?

Apr 20, 2010

I have a very simple asp.net page, just some buttons and one GridView on it. The logic is a user click the QUery button,then the button click event was trigured to populate the gridview with data queried from database via LINQ. for a user friendly interface, in RowDataBound event, I visit every row, change a boolean value into checkbox represention. But it seem that the RowDataBound run twice, because the checkboxs were inserted twice for every row in one cell. so why? the source code snippet as follow:

protected void btnSelect_Click(object sender, EventArgs e)
{
RetiredEmployeeDataContext db = new RetiredEmployeeDataContext();
GridView1.DataSource = db.ENTUserAccountSelectAll();//userAccounts;
GridView1.DataBind();
}
protected void GridView1_OnRowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
CheckBox chkActive = new CheckBox();
chkActive.Checked = ((ENTUserAccount)e.Row.DataItem).IsActive;
chkActive.Enabled = false;
e.Row.Cells[5].Controls.Add(chkActive);
}
}

View 9 Replies

Forms Data Controls :: How To Find The Row Of A Gridview Which Contains A Control That Fired An Event

Dec 20, 2010

I have a Gridview which contains templated column that has 5 checkboxes in it. When you click on one checkbox, I want to uncheck the other 4.

I am using the Item Template for this. I don't want the user to have to Select a row, before clicking on the checkboxes. Here is my non-working code to uncheck the other checkboxes. I realize it's not "SelectedRow" that I want since there's no selected row, so how do I find the row containing the checkbox that fired off CheckChanged?

[code]....

View 2 Replies

Forms Data Controls :: Event Of Child GridView Is Getting Fired Also At The Parent FormView?

Jul 21, 2010

since APS.Net 4.0 I have a curious problem with an event.

There is a FormView and inside of the EditItem there is a GridView. In the Footer of the GridView I put Controls for inserting records.

But when I fire a markup defined RowCommand of that GridView then the same event is getting fired for the Parent FormView. First I had 'Insert' as the CommandName and so I was getting the Error that my FormView had to be in insert mode to insert a record. Then I changed the RowCommand of the GridView to 'xxx' and I got also the RowCommand 'xxx' at the RowCommand eventhandler of the Parent FormView.

The project was migrated from .Net 3.5 a few days ago, but nothing was manually changed in the code/markup. And the problem was not there with the "old" framework.

[Code]....

Of course, I could simply change the CommanName of the LinkButton e.g. to 'InsertChild' but I would like to know:

Is this a known change or a bug of ASP.Net 4.0?

View 1 Replies

Forms Data Controls :: GridView Dynamic Footer LinkButton Event Not Fired On Last Page?

Oct 28, 2010

So I have a GridView control with autogenerated column set to true, it also has autogenerated Edit and Delete buttons, sorting and paging, and also I am binding this same gridview to multiple data sources at runtime. All is working well.

Now I am adding a dynamically generated footer row at runtime. This footer row will allow users to add new record regardless which data source it binds to. So it is working as well except there's a small bug I couldn't figure out why. It's when I navigate to the last page of the gridview, if the rows on the last page is less than the page size, for example, I have page size 10 and the rows in last page is 9, then when I click the 'Add' linkbutton, the Add event does not fire, instead, it fill the last page with additional blank rows, that means if the last page has 5 rows, it will fill 5 blank rows below, if it has 9 rows, it will fill 1 blank row below. Then if you click the add again, it will work. If the last page already has 10 rows then, it works just fine.

Below is the code I used to dynamically add footer row:

[Code]....

View 9 Replies

Forms Data Controls :: How To Tell If The Event That Fired A Post Back Is The Gridview Column Click (to Sort The Grid)

Nov 17, 2010

If the grid column is clicked to sort i dont want to retireve data agian, i can get it from viewstate, but i dont know if that triggered the post back or if the ImageButton on the page triggered it

View 5 Replies

Forms Data Controls :: Gridview / Adding CheckBox In RowDataBound - CheckedChanged Event Not Fired - Page Lifecycle

Jan 5, 2011

I have a page on which everything is loaded dynamically.

There is a Gridview (AutoGenerateColumns=true) and in the RowDataBound I check every column for a boolean datatype. If found I add a checkbox (autopostback=true) to the cell and register the CheckedChanged event.
The problem is, that I only get the CheckedChanged event, if I reload the grid in Page_Load:

protected void Page_Load(object sender, EventArgs e) {
LoadGrid();
}

But this is very expensive and causes that the db request will be executed twice. If I changed the code to what I want:

protected void Page_Load(object sender, EventArgs e) {
if (!this.IsPostBack)
loadGrid();
}

I get no CheckedChanged event.

Is there a possibility to get:

- Adding a Checkbox in RowDataBound
- Only "LoadGrid()" if it is no PostBack
- Getting the CheckedChanged event of the relevant row

View 2 Replies

DataSource Controls :: Connecting To SQL Server In Visual Studio 2008 Using Code - Error: 25 - Connection String Is Not Valid

Feb 2, 2010

Background: I use SQL server 2005 developer edition and visual studio 2008. Visual studio 2008 is running on a local machine with Vista business edition. SQL server is running on a remote server using Windows server 2003. Both computers are within the same domain.

Problem: First, I used the server explorer to connect to the SQL server. Everything works as desired. Then I write code to do the same thing. I keep getting the following error message:

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 25 - Connection string is not valid)

However, I used the exactly identical connection string as the one used in the server explorer. So connection string should not be the problem. In addition, I tried the test code in MSDN, which tells whether my domainusername can flow the network. It turns out the user name is fine. I also went to the SQL server management studio and found the login for my computer is NVCWeihao while my computer login name is NVCweihao. I am wondering if this uppercase letter really affects the connection.

View 2 Replies

How To Export Data Into Excel Which Is Diaplayed Using GridView In Visual Studio 2008

Feb 23, 2011

Im using Visual Studio 2008 and i have created a GridView which displays data from an SQL Table, how could i export this data into an Excel sheet on click of a button.

View 1 Replies

Visual Studio 2008 - Finding Tools For Visual Studio 2008 Which Can Reformat ASPX Code

Jan 6, 2010

Is there any tool for Visual Studio 2008 which can reformat ASPX code to make it more presentable (eg insert line breaks, format the lines so they wrap when necessary, etc)?

View 5 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved