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


Similar Messages:

Forms Data Controls :: Sort Gridview Column Without Going Back To First Page?

Mar 26, 2010

i have a gridview that has the ability to sort by each of the columns, but suppose if i'm on page 2 of the results and sort any of the columns, it jumps back to page 1. is there a way to keep it on page 2, still have the sorted date work?

View 3 Replies

Forms Data Controls :: GridView Disappears When Click A Column Header To Sort?

Jul 28, 2010

I have a page with a TextBox, a Button, a GridView, and a SqlDataSource. I click the Button to execute the SQL in the TextBox using the SqlDataSource. The SqlDataSource populates the GridView. Everything works as expected until I click a column heading to sort.

When I click a column heading, the GridView disappears and I have to click the Button to display the grid again. When I do, the grid is displayed in the order of the column I clicked.

I don't understand why the GridView is disappearing when I click a column header.

Does anyone know how to fix this so the GridView is sorted and displayed only by clicking the column header?

ASPX:

[Code]....

Code behind:

[Code]....

View 9 Replies

Forms Data Controls :: Div Collapses Every Time Click On GridView's Sort Column Header?

Feb 8, 2010

I have several grid views indide div's, and when I click the Sort header on an open div the div collapses and no sort happens. I believe it is just reloading the entire page but when I surround PageLoad with !ISPostBack then the page redraws as blank. Since the sort script is generated by the GV, I don't know how to stop it from creating side effects.

Here's my code:

<script type="text/javascript" language="javascript">
function toggleDisplay(id) {
var obj = document.getElementById(id);
obj.style.display = (obj.style.display == "none") ? "" : "none";
return false; // cancel the href
}
</script>

[Code]....

View 6 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 :: Sort Even Does Not Get Fired In Gridview?

Mar 24, 2011

I am using gridview created by visual components. I have registered gridview_onsortclick event during the page initialisation, but when i try to click on the header of any column, this event does not get fired at that time. This event gets fired only after all the controls, sorting query is generated, filling the current dataset is done. But the same event is getting fired before query is generated and dataset is filled,for the other page. And one more thing to add with it, I want the sort function to be done on the whole dataset regardless of current page. Why is there such a difference in both the pages?

View 2 Replies

Forms Data Controls :: How To Sort Grid On Two Column

May 12, 2010

In gridview I am able to sort on 1 column as mentioned below, I want to add one more column in sorting, what is the best way to do this,

[Code]....

View 2 Replies

Forms Data Controls :: How To Convert A Varchar Column To Int And Sort In Grid View

Jul 21, 2010

I have a grid view with manual sorting. In some cells, the data are numeric and datetime. But due to some constrains, the data type on tables are varchar. The problem here is when I sorting those numeric data, it is treated as varchar.Eg: 1, 12, 13, 2, 23, 3, ...But I wanted the order to be: 1, 2, 3, 12, 13, 23, ...I have tried these method, but it doesnt works.

[Code]...

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

Forms Data Controls :: Dynamic Template In Grid View Disappear While Post Back?

Mar 31, 2010

i am creating gridview with dynamic template, and the grid is disappear while postback. my code is below.

i am using GridViewTemplate class to generate Templates

Public Class GridViewTemplate

View 2 Replies

Page Post Back But Server Click Event Doesn't Fire

Aug 31, 2010

I have a button like this:

<asp:Button ID="btnSave" runat="server" ClientIDMode="Static" Text="Save" OnClientClick="return ConfirmSave();" OnClick="btnSave_Click" />

If I write my client function like the following, it works as expected:

function ConfirmSave()
{
return confirm('Confirm?');
}

But I should check, inside the function, for the confirm result, like this:

function ConfirmSave()
{
if (Page_ClientValidate('validationGroup'))
{
var conf = confirm("Confirm?");
if (conf)
{
$('#btnSave').attr('disabled', 'disabled');
}
return conf;
}
else
return false;
}

Doing this, the page postback but the server click event doesn't fire.

View 4 Replies

Forms Data Controls :: How To Change Sort Column Header Text And Retain The Sort Link

Jun 3, 2010

I have a simple dynamic gridview with following code -

GV = new GridView();

View 3 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 :: How To Sort A Gridview By A Calculated Column

May 25, 2010

Is there a way to Sort a Gridview by a Calculated Column? I have a gridview with template fields using lablels and a linq datasource. Those columns sort just fine. I can not get the Calculated column to sort, because there is no sort expression to use...

View 4 Replies

Forms Data Controls :: How To Sort A Gridview Column By Last 4 Digits

Jan 6, 2011

I have a gridview column named "Job Number" and the number is in this format: 01-04-11-3215, 01-04-11-3216 and so on...

Since the first few characters represent the date I need to sort on the last 4 digits.

View 2 Replies

Forms Data Controls :: Sort A Gridview By A Column That's Not Displayed

Mar 22, 2010

I have a datatable as a datasource to a grid view, it has a column amtDue, i would like to be able to sort by this column,, while not displaying it.

View 4 Replies

AJAX :: Gridview In ModalPopupExtender: Rowcomand Event Not Fired On The First Click?

Mar 9, 2011

I got a strange issue with Gridview in ModalPopupExtender. The OnRowCommand event of the GridView control does not get fired on the first clicking on the button. It will get fired on and after the second clicking.

Code is below.

View 4 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 :: GridView Sort Column Header Underline?

Feb 17, 2011

AllowSoting is true on every column of my gridvieww.

i want to remove those underlines in everycolumn ...

how can i do that?

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

Server Side Function Is Not Fired While Post Back In Jquery Ui?

Mar 23, 2011

There is a drop down list in the jquery ui modal form with id - drpAction.When the selection is changed I need to execute drpAction_SelectedIndexChanged function in the code behind. When I just try to invoke the function like onSelectedImdexChanged="drpAction_SelectedIndexChanged" ,the function is not fired.

View 1 Replies

Forms Data Controls :: Gridview Doesn't Sort On A Specific Column After Updating

May 10, 2010

I have been struggling with this problem for a long time. Does anyone have any clue about this problem? I created a gridview and set the allowsorting to true. This gridview has four columns: Name, Position, StartDate, and EndDate. I want the gridview to be sorted on the EndDate.

Inside of the save event, I called the BindGrid() function to rebind the datasource to the gridview. The changes will shown immediately, but the problem is that the records are not sorting on EndDate. I have to refresh the page manually to get the view sorted.

<asp:GridView ID="gvInfos" runat="server"
CheckBoxEnabled = "true"
ShowEmptyTable = "true"
AutoGenerateColumns = "False"
CssClass = "gv_white"
DataKeyNames = "Id"
GridLines = "None"
Width = "100%"
AllowSorting = "true"
>
<Columns>
<asp:ButtonField CommandName="Select" DataTextField="Name" HeaderText="Name" />
<asp:BoundField DataField="Position" HeaderText="Position" />
<asp:BoundField DataField="StartDate" HeaderText="Start Date"
DataFormatString="{0:Y}" />
<asp:TemplateField HeaderText="End Date" SortExpression="EndDate">
<ItemTemplate>
<%# (((DateTime)Eval("EndDate")).Year == (DateTime.MaxValue.Year) || (DateTime)Eval("EndDate") == null) ? "Present" : ((DateTime)Eval("EndDate")).ToString("y")%>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>

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







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