Forms Data Controls :: ListView OnItemCreated Event Crashes When OnPagePropertiesChanging Is Fired

Jan 22, 2011

I have a list view. Its OnItemCreated event works when page loads and items are displayed successfuly. However when, page index changed it says

Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index Followings are my methods:

protected void listview_ShowroomItems_OnPagePropertiesChanging(object sender, PagePropertiesChangingEventArgs e)
{
pager_ShowroomItems.SetPageProperties(e.StartRowIndex, e.MaximumRows, false);
MembershipUser currUser = Membership.GetUser(User.Identity.Name);

[Code]....

View 2 Replies


Similar Messages:

Forms Data Controls :: ListView Ajax - Use A LinkButton Then The Page_Load Event Is Fired?

Feb 3, 2011

I have discovered something strange when using a ListView. I have a listview contained inside an uodate panel and everything works OK until I edit the editItemTemplate to use a LinkButton instead of a Button.When i use a LinkButton then the Page_Load event is fired.

View 3 Replies

Forms Data Controls :: RowDeleting Event Is Not Fired?

May 24, 2010

I have a rowDeleting even on my gridView. When I click Delete link, the Rowdeleting is not fired. I checked my aspx...and I have it there...I dont see any problems there..bu still when I click delete, my page is refreshed without calling RowDeleing event.

View 20 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

Web Forms :: CSS For ListView Crashes For FireFox 3.0?

Jul 21, 2010

My css for listview Crashes for FireFox 3.0 and it works fine in IE 6 and 7 and FireFox 2.0. How to handle this?

View 2 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 :: Mouseout Event Going To Be Fired - Even Pointer Moves From One To Another Row

Jun 1, 2010

I am creating a user control to serve as a multi select, multi column drop down. i.e more than one items can be selected. To achieve this, I used GridView control to dispay multiple columns when user clilck on image of drop down, first column containing CheckBox to select multiple rows. I have registered mouseout event handler for GridView control, to hide GridView when mouse leaves GridView area.

But mouseout event is going to be fired even mouse pointer moves from one row to another row. I have seen HTML in browser, mouseout is registerd in table rather than each row.

View 1 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 :: 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 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

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 :: Button Event Not Getting Fired In Extended Grid View?

Feb 3, 2011

have extended a gridview to have all basic common functionalities like export to excel.So an image button will automatically rendered for exporting the gridview. I have added the link button in my extended gridview.when i click the button it gets postback. but the event does not get fired. I created the link button during overrided grid init method.and rendered during overided render method.I got stuck in this for a whole day..

View 1 Replies

AJAX :: SelectedIndexChanged - Why Event Fired Within The Onblur - Event When It's Fired Anyway

May 3, 2010

[Code]....

A breakpoint is set on FillForm() and this method is called two times but I can't explain myself why this happens. I have client side javascript code, when the form is being send, the onsubmit method is also called twice... Where do I have to search?! Is it a (known) bug? Think I could get it to work with this Thread: [URL] But why is the event fired within the onblur-event when it's fired anyway??

View 2 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

Forms Data Controls :: Selected Index Changed Event Fired On Page PostBack?

Jan 13, 2011

On Button click(postback), my dropdownlist of gridview is getting blank, so i m getting error of "Object Reference...." on the line "ddl.selecteditem.value"Also, dropdownlist's selectedindexchanged event is fired on Button Click(Page Postback), which is making the dropdownlist to go blank. AutoPostBack of dropdownlist is set as False,

View 8 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 :: 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 :: Cannot Find Control Within Repeater When Selected Index Changed Event Is Fired

Aug 27, 2010

I have a panel which has a repeater within it. Within the repeater I have a few controls. One of those controls is a Drop Down list which has an OnSelectedIndexChanged event. I can get this to fire without issue but I cannot find my DropDownList control within that repeater within the SelectedIndexChanged event . The repeater has an OnItemDataBound event and I can use the RepeaterItemEventArgs to find the control using e.Item.FindControl("ControlName") without issue but when that event occurs is NOT when I need to find the DropDownList.

What I want to do is have another control's Visible property be set to "true" when the value of the DropDownList meets a certain value. As far as I know I can only do this during the SelectedIndexChanged event and I can't change the signature of the event by trying to use RepeaterItemEventArgs.

View 1 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

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

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 :: 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 :: 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 :: 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







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