C# - When Deleting The 11th Row The Grid Become Blank?
Nov 15, 2010
I have one telerik rad grid.Using a method i am filling the grid.I have enabled paging property.I have used itemtemplate-->ImageButton for delete and edit options.I have set page size as 10.Page load time it is working properly and populating the grid.After inserting 11 th row the pagination starts and it will show in next page with one record.But when i am deleting the 11th row the grid become blank.I have used dataset to bind the records.
[code].....
View 1 Replies
Similar Messages:
Jul 26, 2010
I have enter the value in gridview using datarow and ihave allowed user to select particular row using checkbox and pressing delete buttons.
View 8 Replies
Sep 30, 2010
I have a form that when I click the delete button I want it to refresh the grid with that record removed from the grid. Does anyone know how to do this. Is this something handled in the code behind? Here is my code for the delete button on the design page:
[Code]....
View 17 Replies
Jun 21, 2011
i'm using this code;
Code:
Protected Sub GridView1_RowDataBound(sender As Object, e As GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then
Dim l As LinkButton = DirectCast(e.Row.FindControl("LinkButton1"), LinkButton)
l.Attributes.Add("onclick", "javascript:return " & "confirm('Are you sure you want to delete this record " & DataBinder.Eval(e.Row.DataItem, "CategoryID") & "')")
End If
End Sub
but i still encounter these errors:
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
View 8 Replies
Nov 15, 2010
i am working in MVC & using mvccontrib grid to show the result in grid format.
the Grid is showing up all my database records & now i want that a blank row should be added at the end of the grid which i can us eto add a new record .
let me know how i can add a blank row at end of mvc contrib grid
View 1 Replies
Mar 17, 2011
I have created a gridview which adds a remove button through item template. I wish to know how do u remove the row from grid view dynamically depending upon the button he clicks ?
protected void RemoveBtn_OnClick(object sender, EventArgs e)
{
Button clickedButton = sender as Button;
GridViewRow row = (GridViewRow)clickedButton.Parent.Parent;
int rowID = Convert.ToInt16(row.RowIndex);
GridView1.DeleteRow(rowID);
}
<asp:GridView ID= "GridView1" runat="server" AutoGenerateColumns="true" OnRowDeleting="RowDeletingEvent">
<Columns>
<asp:TemplateField HeaderText="Remove Items">
<ItemTemplate>
<asp:Button id="RemoveBtn" runat="server" Text="Remove" OnClick="RemoveBtn_OnClick"/>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
View 5 Replies
Mar 4, 2010
I am using user control but it appears blank
The following class is used to to Bind Grid View in User Control
[Code]....
Following is the user control .ascx file (this uses LinkTableItem class to bind GridView)
[Code]....
The Following is the .ascx.cs file
[Code]....
The following is the .aspx.cs file
[Code]....
The Grid in User controls Appears blank.
View 1 Replies
Jun 25, 2010
I found code [URL] that allows multiple-row inserts, and tried to convert it to vb.net. I can't get the blank grid with 5 rows to show up -- for some reason the datasource won't bind.
[Code]....
Code gridview:
[Code]....
View 4 Replies
Dec 7, 2010
How to create a Grid view with 3 blank Row without any Datasource or use (Datatable ) in code behind
it means
Sl.no ID Name
1
2
3
it means no blank ID ,Name
View 8 Replies
Dec 8, 2010
my gridview column coming from database dynamicly it may be 10 or it may be 20. i added a blank row in grid throughdata table . i want to write something in this row and change color.
View 1 Replies
Sep 27, 2010
I have a repeater which binds a set of data. Within this repeater is a column with various controls for updating, deleting, etc. These are image buttons which fire an onclick event such as "DeleteRecord". All this does is fire a stored procedure, passing in the ID of the record to delete from the CommandArgument of the object.
This works wonderfully... except for one rather huge problem. Once you delete a record, if you refresh the page, the record where the first deleted record used to be gets deleted. For instance... if I have 4 records
1 Record1
2 Record2
3 Record3
4 Record4
and I delete record 2... The page reloads with (which is fine):
1 Record1
3 Record3
4 Record4
...if I then hit refresh...
1 Record1
4 Record4
I assume this is because the erroneously deleted object (record3) is now in the same hierarchical place as the old object used to be and .net therefore doesn't know the difference, the page refreshes and fires the onlick event, grabbing out the command argument of the new object and deletes based on the ID as obtained from the commandargument of the new object. This is obviously a huge problem, if a client did this it would destroy data erroneously and I'm at a loss here. Is there any way to stop this from happening? I'm not sure if there is a better way to go about doing things or not. If there isn't, I need some sort of way to tell the page not to execute the event or to cross reference the ID of the object that is intended for deletion against the object itself...
Code below for convenience...
EDIT Wrapped a LinkButton around it because I have some jquery code in here as well which stops the page execution to wait for user confirmation. Pressing "ok" continues page execution.
<asp:LinkButton ID="oDeleteLink" CssClass="oDeleteIcon" CommandName="Delete" CommandArgument='<%# Eval("iAccountID") %>' runat="server">
<asp:ImageButton ImageUrl="/files/system/icons/trash-steel-16.png" ToolTip="Delete This Account" AlternateText="Delete" ID="oDeleteIcon" runat="server" />
</asp:LinkButton>
protected void oAccounts_ItemCommand(Object Sender, RepeaterCommandEventArgs e) {
if (e.CommandName == "Delete") {
int ID = e.CommandArgument.ToString().Numeric();
db.SPs.SpDeleteAccount(ID).Execute();
UI.Confirm(uiBroadcast, "Account has been deleted", "300px");
BindAccounts();
}
}
View 2 Replies
Jun 2, 2010
I have a form which a user can fill in x times with the data they want too. The form is posted to the following Action.
[HttpPost]
public ActionResult Manage(ProductOptionModel DataToAdd)
{
if (!ModelState.IsValid)
{
return View(DataToAdd);
}
var ProdServ = new ProductService();
if (DataToAdd.ID != 0)
{
//Edit Mode.
DataToAdd = ProdServ.EditProductOption(DataToAdd);
ViewData["Message"] = "Option Changes Made";
}else
{
//Add
DataToAdd = ProdServ.AddProductOption(DataToAdd);
ViewData["Message"] = "New Option Added";
}
var RetModel = new ProductOptionModel() {ProductID = DataToAdd.ProductID};
return View(RetModel);
}
So at the bottom I blank the model (Leaving just the required field) and then return to the view. However the view holds the data from the previously submitted form. I have debugged the code and checked that the RetModel variable is empty.
View 2 Replies
Jan 16, 2011
i have one grid and one button when i click on that button then it expand and showing another grid under the row of parent grid how to do that.
View 2 Replies
May 19, 2010
Problem in YUI:I am using YUI grid,my dataset contains some special character.i bind my dataset into the grid,but its not displayed in my grid? how to solve this
View 1 Replies
Jun 23, 2010
Have a GridView with a templated select button hidden and using
e.Row.Attributes.Add("onclick",Page.ClientScript.GetPostBackEventReference(this.grdMaster, "Select$" + e.Row.RowIndex.ToString())); to select a row .
When user like to update the datasource he will select one row from gridview then in selected indexchanged event i would display the selected row values beneath the form under the grid , Then user will update the contents displayed from grid and click an update button which is outside the grid . After updating the displayed row , i got to get the values of the next row in the grid and display them for next updation , i'e if users maually selects row 3 from grid then he can update the values using the update button and then on update click itself i'll have to display next row contents of row 4 and this process could go on .
View 3 Replies
Mar 12, 2010
I have Parent/Child Grid (also called Nested Grids).
Parent Grid (PG) :: PG has two template fields. 1st template field has "Category ID" and 2nd template has Child Grid
Child Grid (CG) :: CG is populated in PG's RowDataBund event based on "Category ID". In CG's DataBound event, I am doing something which I need to display in CG's footer row.
Problem :: In the footer row of each CG, I have to show the "Category ID" which is in PG' row. How can I get hold of the PG's row which hascurrent nested grid (there will 'n' child grids, one for each 'Category ID' in the PG ) so I can read the "Category ID"
I was thinking if I could do something (DataBound event of CG) like this..
string catId = ChildGrid.Parent[get the index of the current row in PG].Cells[0].Text;
View 2 Replies
Mar 31, 2010
how to remove grid lines from Grid View suing style sheet...
View 1 Replies
Mar 24, 2010
In a ASP.NET application I have a paging RadGrid which shows up textbox in each row. Outside the grid, there is an OK button to save the content of all the textbox. If user changes text in any one or more of the textbox and without clicking on the "OK" button, tries to move to a different page number (of the grid by clicking on the page number), he should be prompted for confirmation of save or cancel the changes.
I am guessing that one can write a Javascript function which would look for any form input control (textbox in my case) and detect changes and If there are changes, would prompt the user. However, I am not sure where I can call this function from?
I am using RadGrid but I guess this should be applicable to GridView as well.
View 1 Replies
Jun 30, 2010
I'm getting some Xml back from a service. I would like it to be the datasource of a grid view on my aspx page. Here is a sample of the Xml
<?xml version="1.0" encoding="utf-16" ?>
<ArrayOfTripTollCompleteDC xmlns:xsi=[URL]"
xmlns:xsd=[URL]>
<TripTollCompleteDC>
<TripTollId>5</TripTollId>
<DMSLaneModeID xsi:nil="true" />
<HOVOnly>false</HOVOnly>
<CreateDateTime>2010-06-07T15:54:01.023</CreateDateTime>
<ConfigVTMSDelaySeconds>5</ConfigVTMSDelaySeconds>
</TripTollCompleteDC>
and here is my code that parses the xml and tries to bind the grid. What am I missing here?
var retVal = service.GetTripDetailsByTripID(tripId);
var xmlTrips = XDocument.Parse(retVal);
var tripTolls =
from t in xmlTrips.Elements("TripTollCompleteDC")
select new {
TripTollId = (int)t.Element("TripTollId")
, DMSLaneModeID = (int?)t.Element("DMSLaneModeID")
, HOVOnly = (bool)t.Element("HOVOnly")
, CreateDateTime = (DateTime)t.Element("CreateDateTime")
, ConfigVTMSDelaySeconds = (int)t.Element("ConfigVTMSDelaySeconds")
};
grdTripDetails.DataSource = tripTolls;
grdTripDetails.DataBind();
I realize these are anonymous types. Is that a problem? I have verified the service is returning the Xml as stated above. Can anyone out there point me in the right direction? Just for completeness, here is the grid markup <asp:GridView runat="server" ID="grdTripDetails" />
View 1 Replies
Jun 1, 2010
i am trying to add subtotal in gridfooter with has grid inside grid
View 1 Replies
Feb 2, 2011
I have an entity "Order", which contains a set of states. Every state has date and name.
I want show grid with all orders and in grid one column with last state of order. But I dont understand how to do it.
View 1 Replies
Jul 6, 2010
I am trying to create a second grid in the same page with detailed info for a given record of the first Grid, but when I press select in the first grid nothing happens. I follwed everything I read.
<asp:GridView runat="server" AutoGenerateColumns="False"
DataSourceID="SqlDataSource1" style="margin-right: 0px" Width="659px"
AutoGenerateDeleteButton="True" AutoGenerateEditButton="True"
AllowSorting="True" DataKeyNames="accession_num,organ"
EnablePersistedSelection="True" EnableSortingAndPagingCallbacks="True" onselectedindexchanged="Unnamed1_SelectedIndexChanged"
>
<Columns>
<asp:BoundField DataField="organ" HeaderText="organ"
SortExpression="organ" />
<asp:BoundField DataField="weight" HeaderText="weight"
SortExpression="weight" />
<asp:BoundField DataField="unit" HeaderText="unit" SortExpression="unit" />
<asp:BoundField DataField="accession_num" HeaderText="accession_num"
ReadOnly="True" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:pdmstestConnectionString %>"
SelectCommand="GetGrossOrgan" SelectCommandType="StoredProcedure"
UpdateCommand="UpdateGrossOrgan" UpdateCommandType="StoredProcedure"
DeleteCommand="DELETE FROM [Pathology_Gross_Organ] WHERE [accession_num] = @accession_num AND [organ] = @original_organ"
OldValuesParameterFormatString="original_{0}"
> <SelectParameters>
<asp:ControlParameter ControlID="accession_num" Name="accession_num"
PropertyName="Text" Type="String"/>
</SelectParameters>
<DeleteParameters>
<asp:Parameter Name="accession_num" Type="String" />
<asp:Parameter Name="original_organ" Type="String"/>
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="accession_num" Type="String"/>
<asp:Parameter Name="organ" Type="String"/>
<asp:Parameter Name="weight" Type="Int16" />
<asp:Parameter Name="unit" Type="String"/>
</UpdateParameters>
</asp:SqlDataSource>
View 8 Replies
Sep 29, 2010
I have a grid view that does add, edit update and delete. ( I draged the grid to the aspx page ) it is working. I would like to have the following : once I lick on edit, I open a form inside the grid view to edit the fields. How can I do that.
View 4 Replies
Jan 20, 2010
I'm using ASP.NET/VB and am wanting to nest a grid inside of another grid. I've seen them but am unsure how to make them work. I have a Orders table with an OrderID and it is linked to a Orders_Detail table. I would like to be able to select the order and see the details. I've done it differently with 2 grids outside of each other, but this isn't the solution I need.
View 1 Replies
Mar 2, 2010
I have a Select All checkbox in my grid that calls this function...works fine. Outside of my grid I'd like to use another checkbox for something else, but when the select all checkbox in the grid is selected, it also selects my checkbox outside of the grid. Is there way to make the checkbox outside of the grid independent from the ones in the grid?
[code]....
View 4 Replies