Forms Data Controls :: Datagrid Datakeys Seem Not To Work Properly

Mar 9, 2011

I have a Datagrid one of the colums is a checkbox and when it is selected I' m supposed to update that row. I have a button to update this outside the Datagrid. It seems to work well for the first two rows but after that meaning starting 3 to any it just doesnt update no errors but doesnt update. When I look into the id it seems to be empty.

Private Sub btnInactivateAllSelected_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnInactivateAllSelected.Click
'
'Function declarations
Dim currentMethod As String = MethodBase.GetCurrentMethod.Name
'Object declarations
'Variable declarations
Dim ruleID As Guid = Nothing
Dim oRule As PSXSTL.Digecenter.Rule = Nothing
Dim changetext As String = Nothing
'Start Try...Catch statement
_moduleName = "btnInactivateAllSelected_Click"
Try
For Each item As DataGridItem In GroupDataGrid.Items
If CType(item.FindControl("chkApprovalCheck"), CheckBox).Checked = True Then
ruleID = GroupDataGrid.DataKeys(CInt(item.ItemIndex))
oRule = New PSXSTL.Digecenter.Rule(DirectCast(Session("CustomerID"), Guid), ruleID)
If oRule.Complete Then
oRule.RuleStatus = False
oRule.ActiveDate = Now.ToString
changetext = "On " + Now + " " + Session("FirstName") + " " + Session("LastName") + " deactivated the Rule."
If Not oRule.ProofReviewed Then
changetext = changetext & " PDF not viewed"
End If
LogEditHistoryItem(changetext, ruleID)
' Call
' added 10/19/2004 by Rob MacMorran
LogBulkOrderHistory(oRule)
oRule.Update()
End If
oRule.Dispose()
End If
Next
' Server.Transfer("customer_clientrules_results.aspx")
Catch ExceptionObject As Exception
'Write the exception out to the event log.
EventLogHelper.LogException(ExceptionObject, _moduleName, "Error occurred in " & _moduleName & "/" & currentMethod & ControlChars.CrLf & ExceptionObject.StackTrace, EventLogEntryType.Error, 55555)
Finally
'Cleanup
'Object disposal
If Not oRule Is Nothing Then
oRule.Dispose()
oRule = Nothing
End If
'Variable disposal
ruleID = Nothing
changetext = Nothing
'Function variable disposal
currentMethod = Nothing
End Try
Server.Transfer("customer_clientrules_results.aspx")
End Sub

View 5 Replies


Similar Messages:

Forms Data Controls :: Datagrid Cell Editing - Code Is Not Properly Working?

Apr 9, 2010

How to do the datagrid cell editing? My need is "I want to update the datagrid cell values individually". At that time of editing, i want to pick the values from dropdownlist, calendar,etc.. controls.I tried a code, but its not working properly. I always taking the cell value only, not the control value. H

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="TestGrid.aspx.vb" Inherits="TestLeadManager.TestGrid" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" > [code]....

View 3 Replies

Forms Data Controls :: Why Doesn't The FormView PageIndexChanged Work Properly

Jan 7, 2011

I thought that the "PageIndexChanged" is fired after the index has changed?

In other words when I'm at page 1 with a labelnumber 11 and I click on page 2, where the labelnumber =
22 and I do

the event "PageIndexChanged" I got the number "22" if I do the following code:

[Code]....

But that is not what happens I still got the labelnumber from page 1.

Did I understand the "PageIndexChanged" event wrong or is this a bug?

Because this is not working does somebody know how to solve this problem?

View 20 Replies

Forms Data Controls :: CheckBox In DataGrid Doesn't Work

Feb 25, 2010

I am making checkbox in datagrid, no matter what I try, I cannot get the right result from checkbox. Even I check or not check the checkbox, the result is false. It is like somehow the result is always the default value of the checkbox.

Here is code:

private void OrderButton_Click(object sender, System.EventArgs e)
{
CheckBox x;
foreach ( DataGridItem dgItem in DataGrid1.Items)
{
x = (CheckBox)dgItem.FindControl("OrderCheckBox");
this.ALERT(x.Checked.ToString());
}
}

And here is my html:

[Code]....

View 4 Replies

Forms Data Controls :: Onchange To Work On Datagrid Order Form?

Jan 14, 2010

I'm having trouble generating onchange event code for a simple order form housed in a datagrid.This takes product items from sql database,whereas user can enter quantity (originally set to 25) of cards they want to order (the textbox id is txtQty). if they order 50 (so if they order 25 to 49,the price would stay the same for the lot),the subtotal for that given product will change another 15 dollars greater.,so the formula for the price wouldnt be product * price, but "if qty = qty + 25 then subtotal = price + 15".Then the button click event would add the subtotals to a grand total.

I cannot coordinate teh adequate javascript that would fit with this type of scenario,given that this is all predicated on each product coming from the database; i'm wondering if there is another good source i can be directed to that would show helper functions in the code behind or header subs to calculate the onchange (or textOnchange) event of the textbox.

<form name="mydgrid" runat="server">
<asp:DataGrid id="dgProducts" runat="server"
AutoGenerateColumns="False" CellPadding="4"

[code]...

View 1 Replies

Forms Data Controls :: Using Datakeys In A Gridview?

Jul 16, 2010

I have a gridview with a linkbutton in each row. When I click the linkbutton it should update the status of a field from enabled to disabled. I am using a stored procedure to achieve this but i need to pass in a ApplicationID which i am retrieving from the gridview through the use of datakeynames. I am using the code below to get this value into a variable.

iAppID = gvApplications.DataKeys(gvApplications.SelectedIndex).Values("iApplicationID")

However when it runs it gives me the following error:

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

View 2 Replies

Forms Data Controls :: How To Access Datakeys In Javascript

Aug 24, 2010

How To Access Gridview's Datakeys In Javascript...and How To make gridview Column Visible true in javascript

View 2 Replies

Forms Data Controls :: Use Multiple Datakeys In Nested Gridview?

Jul 22, 2010

my page based on master and Details. there are two gridview one is header and other detail.detail gridview is inner gridview.so when i click on + symbol then details should diplay.i use dataKeys for display Inner gridview record.when i use one datakeys then it is working fine but i need two condtion for show Inner Gridview. how can use multiple datakeys here?my HTML code is below. just modify it for multiple Datakeys

[Code]....

View 8 Replies

Forms Data Controls :: How To Clear Datakeys Of Gridview In Code Behind

Feb 15, 2010

i want to clear datakeys of gridview from code behind

here is gridview

<asp:GridView ID="gv" runat="server" DataKeyNames="row_ID" AllowSorting="True" AutoGenerateColumns="false">
</asp:GridView>

and i added columns dynamically from code behind

[Code]....

View 2 Replies

Forms Data Controls :: Fetching Datakeys From The Child GridView?

Aug 31, 2010

I am trying to update a row of the child gridview through a link button template field but how do I fetch the datakeys of the child gridview ?

View 1 Replies

Forms Data Controls :: Gridview Paging Clears DataKeys?

Jun 21, 2010

I'm using a Gridview with Paging enabled. Also i'm using the Datakeys in Gridview. I can able to get the DataKeys values on first page. But when i click on the second page, i'm not able to get the DataKeys values. How to get the DataKeys values on Paging.

View 5 Replies

Forms Data Controls :: ListView Paging Dies Using Datakeys?

Mar 19, 2010

I've got a big problem here with the ListView control. Basically I've got very basic code, yet it seems to break the control completely.

Here's the deal, I got a simple ListView using an ItemTemplate containing a hyperlink. Obviously the hyperlink has to lead somewhere after clicking, so the datakeys enter the scene since I need to hook up a hyperlink containing the Id of the record it's in as a parameter.

Normally this shouldn't be a problem, so in the itemcreated event I look up the link control and add the url using data foud in the datakeys.So far so good, this all works out fine.

Now this contains a number of records, too many to display on one page, so I decided to implement paging by using a DataPager, which is the way to get the ListView to support paging. This didn't work.

After a little tinkering around with the code, I found that if I didn't get any datakeys in the itemcreated event, that it all works fine. However, I need to use the datakeys or I won't be able to hook up a url to the hyperlink.

Basically, that one line of code completely kills paging. Commenting it out immediately sets things right, but that's not an option.

[Code]....

View 4 Replies

Forms Data Controls :: DataKeyNames & DataKeys Not Working On Other Pages?

Feb 21, 2011

When the page is displayed have labels, textboxs, and dropdownlists on top part of the page then the gridview at the bottom with the page numbers at the bottom of the gridview. Create the columns and add data to the gridview programmatically with several hidden columns. Use DataKeyNames on the source page and use DataKeys in VB.Net code behind to get data from the hidden column cells of the selected row. On the
first page when a row is selected, the textboxes and dropdownlists have thecorrect information from the gridview hidden columns. When select another page from pages numbers at the bottom of the gridview and select a row from the new page, get theinformation from the hidden column from the first page andcorrect data from the columns that are displayed onnewly selected page.

View 1 Replies

Forms Data Controls :: How To Filter Child Datagrid On Parent Datagrid Row Select

Apr 6, 2010

I have 2 grids gvParent & gvChild I would like to filter gvChild when a row is selected in gvParent the linking fields are contractNo

I added a column for selecting:

<asp:TemplateField ShowHeader="False">
<ItemTemplate>
<asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Select"
OnClick="LinkButton1_Click" Text="Select"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>

I know how to handle the filtering of the grid (create a criteria and set to rowfilter of the dataview) But, I dont know how to get the value of the column of the selected row.

View 5 Replies

Forms Data Controls :: Want To Capture - Datagrid On Clcik On Datagrid Row Value Using C#?

Mar 4, 2011

I have Datagrid , i want to clcik on row and get data in textbox , but my textbox is FreeTextBox control,i tried to use javascript but work for asp.net control not working for freetext box control, how i can capture this code is sample code but it work for asp.net control but not working for my freetextbox

[Code]....

View 1 Replies

Forms Data Controls :: How To DataGrid SelectIndex Inside A DataGrid

Sep 22, 2010

Simply put... I want to duplicate the example found at this link, in VB.net rather than C#.

[URL]

I would like the selectedvalue of the dropdown to display additional data base on its selection in multiple text boxes.

I have tried using the DropDownList OnSelectedIndexChanged property, within a DataGrid EditiItemTemplate, but I cannot retrieve data from the selection. (AutoPostBack is "True"). I can however use a button onclick event to fire a "prre-defined" selection value.

View 2 Replies

Web Forms :: Sort Datatable Does Not Work Properly?

Mar 15, 2010

now i use the dataview to sort the seq of datatable and bind to repeater, it can only display the seq correctly.but i found that it is not the actual database seq, when i remove the row from the datatable, it is not remove the record that i see from the UI.do i need to sort the seq to the actual datatable not the dataview.now i use the seq (int) in datatable to sort the datatable as belows:

DataView view = dt.DefaultView;
view.Sort = "SEQ";
repeater.datasource=view;
repeater.databind();

View 4 Replies

Web Forms :: Like Statement Doesn't Work Properly

Sep 17, 2010

I wrote a statement such that

cmd ="select [title] from products where sku='% "3.5 caddy" %'"

this statement wont return anyfin where there is products with titles startin with 3.5 or ending with caddy or containing 3.5 caddy but just not together for example there is this title "3.5" IDE to USB 2.0 Aluminum External Silver HDD Enclosure Caddy" and that search of 3.5 caddy wont pick this item up as 3.5 is at the start and caddy is at the end.

View 1 Replies

Forms Data Controls :: How To Find DataGrid Row From Another DataGrid

May 27, 2010

I have 2 datagrid (using .net 1.1). I need to access column of second grid ( i need to make a column of second grid as disabled) when i click "Cancel" link button in First Grid. How can this be done?

View 7 Replies

Web Forms :: Upload Control Wont Work Properly

Mar 2, 2010

why my upload control will not work properly when placed inside an ajax tab control? If I place it outside the tab control everything works great.Here is what I'm trying.

[Code]....

[Code]....

View 1 Replies

Forms Data Controls :: Values From Multiple (non Primary And Primary) Datakeys?

Mar 6, 2011

I have the following gridview (ID=Gridview1)

I have added pid (primary key), chkblood,chkurine,chkstool,chkmalaria as datakeynames.

what I want to pull off here is .... when I click select I'll be redirected to this wizard

[Code]....

I did that....now I want to hide / skip steps in the wizard depending on the condition of checkboxes (chkblood, chkurine,chkstool,chkmalaria)

but I cant get the value from these non-primary datakeynames...

View 2 Replies

Web Forms :: Delete Directory And 2 Files That Are Inside Does Not Work Properly

Mar 13, 2010

I have a ListBox1 on the Form that I read in the same Directories: "GetS" as in the code below.

Now I select the first index wich is 0 in the listBox with the mouse and press Button1.

What the code below does is to find that specific folder that also contains a .BMP file and a file: File1.txt

So I will first delete the .bmp file and the File1.txt and at last the directory.

My problem is as follows. When I press Button1 the First time, nothing at all was deleted but the second time I press the Button1, the .BMP file and the File1.txt were delete fine.

But the code breaks at this line and says that the directory isnīt empty. But the directory is empty as I can see when open it manually.

So initially my problem is why the .BMP, File1.txt and the directory arenīt deleted at the first press of Button1 ? (ListBox1 has AutoPostBack set to TRUE and everything is put inside an updatepanel)

[Code]....

View 7 Replies

Forms Data Controls :: Datagrid With Column Choose To Choose Columns Dynamically Using DataGrid With Object Data Sour

Sep 30, 2010

I have "Order" object with Columns Ticket,OTP and CustomerName etc.Intially on DataGrid, I'm binding Ticket only , when user clicks on "Column Chooser" button, another windows appears to pickup CustomerName,OTP columns to add specified column dynamically on Datagrid. Environment : Asp.net ,C# with Object Data source

Public Class Order
{
publc void Order()
{
}
public string Ticket
{
get
{
return this.strTicket;
}
set
{
this.strTicket = value;
}
}
public string OtpNumber
{
get
{
return this.strOtpNumber;
}
set
{
this.strOtpNumber = value;
}
}
public string CustomerName
{
get
{
return this.strCustomer;
}
set
{
this.strCustomer = value;
}
}
}
}

View 1 Replies

.net - Can't Get FormsAuthentication To Properly Work With WCF?

Apr 15, 2010

I have both the wcf and asp.net project together in the same project. (I'm running on Azure, so this is more convenient).I have this set in the web.config:

<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
</system.serviceModel>
y wcf service is decorated with:
[code]...

View 1 Replies

Calendar.SelectedDate Does Not Work Properly?

Jan 14, 2010

I'm using ASP.net 2.0. I want to set a calendar control's selected date to 30 day before today. My code is like this:

theCalendar.SelectedDate = DateTime.Now.Today.AddDays(-30);

but It does not work.

View 1 Replies







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