ListView insert - no current records

I have a ListView that I am using to edit and insert rows into a database 
table.  I am displaying records for a specific person and existing records 
edit and update fine.  Also, if a person already has records in that table, 
the ListView DropDownList population and insert works fine.  The problem is 
that when a person has no records in the table (ListView is empty) the 
DropDownLists are not getting populated.  I assume maybe because the DDL 
populating is being done in the ItemDataBound event?  If so, where is the 
best place to populate the dropdowns for insert?  Below is some of the code 
in my ItemDataBound event used to populate the DDL's.  Thanks.


    Protected Sub lvClientExpenses_ItemDataBound(ByVal sender As Object, 
ByVal e As System.Web.UI.WebControls.ListViewItemEventArgs) Handles 
        Dim ddl As DropDownList
        Dim intExpenseID As Int32 = 0
        Dim intBranch As Int16 = 0

        'Get the item and row objects.
        Dim dataItem As ListViewDataItem = CType(e.Item, ListViewDataItem)
        Dim rowView As DataRowView = CType(dataItem.DataItem, DataRowView)

        ' Retrieve the PeopleLinkID value for the current item.
        Dim intPeopleLinkID As Int32 = 

        'Verify there is an item being edited.
        If lvClientExpenses.EditIndex >= 0 Then
            ' Check for an item in edit mode.
            If dataItem.DisplayIndex = lvClientExpenses.EditIndex Then
  ...code is here to load dropdowns for edit
            End If
            If lvClientExpenses.InsertItemPosition = 
InsertItemPosition.FirstItem Then
                'showing insert row
                If e.Item.ItemType = ListViewItemType.DataItem Then
                    ddl = 
                    ddl.DataSource = LookupClass.GetExpenseTypes()
                    ddl.DataValueField = "ExpenseID"
                    ddl.DataTextField = "Expense"
                    ddl.Items.Insert(0, New ListItem("", ""))

                    ddl = 
                    ddl.DataSource = 
                    ddl.DataValueField = "PayeeID"
                    ddl.DataTextField = "Payee"
                    ddl.Items.Insert(0, New ListItem("", ""))
                End If
            End If
        End If

    End Sub 

11/12/2009 3:09:12 PM
dotnet.framework.aspnet 1425 articles. 0 followers. Follow

0 Replies

Similar Articles

[PageSpeed] 46


Similar Artilces:

how to auto insert rows in Excel
Hello I have a huge excel worksheet that I need to insert rows and subtotal between sections. For example: Class 11 Class 11 Class 11 Subtotal Class 12 Class 12 Class 12 Subtotal How can I automatically do this? Right now, the manual intervention takes a 1/2 day! Thanks for any insights tg Tanya Have you taken a look at Data>Subtotals? -- HTH Nick Hodge Microsoft MVP - Excel Southampton, England "TanyaG" <> wrote in message > ...

how do i insert references (footnotes, endnotes) in ms excel?
I'm needing to insert some references or endnotes in an excel report to explain details of a financial statement. Is there a way to do this easily? For example, if I have 8 footnotes and realize I need to add an additional one in the beginning, is there a way that all of them will change so I don't have to change 16 things? I think I would just put them on a separate worksheet. Or do you mean you've added footnote characters to existing cells (from your previous superscript question) and you want to keep them in sync. If you do, then I think it's a manual effort. (Exc...

Network Programming
All, Please excuse the duplicate posts. I have been given a assignment recently to track URL requests on client machines. This process will just record requests entered by users in Client web browsers. Is there a way to track DNS requests? The process will be on each of the users machines. Is there any good books and/or examples out there on such a task? I have not done much network programming in Windows. I have done a course or two in Unix network programming back when I was in college but thats more then a while back. Any good pointers or suggestions are really appreciated, Thanks, ...

Access 2007: Record update timestamps
Hi all, I've been fighting with this one and can't find any information on it. I have a feeling it was easier to do this with Access 2003, but maybe not. If anyone can help me out, I'd appreciate it. In Access 2007, I have a form where if I edit any (or specific) fields I want it to stamp the current date and time in a separate field. So, for example: I have a "Notes" field. If I edit this field, I want it to stamp the time in a "DateModified" field at the bottom of the form. I have tried to use onDirty, AfterUpdate, BeforeUpdate with expressions as well as V...

Record time by formula
hi, i want to create excel sheet wherein time has to be recorded multiple time. Now() formula does not help and i don't want to use macro. Pls Suggest ???????????????????? -- Regards Dave Hawley "karim" <> wrote in message > hi, > > i want to create excel sheet wherein time has to be recorded multiple > time. > Now() formula does not help and i don't want to use macro. > Pls Suggest i want to record start time and e...

Selecting Data from Another Record
I have a table that contains an event number and the event date. tblEvent: fldNo, fldDate When someone is invited to the event, in case they can't make it, I want a query to show the fldDate from the next record. qryEvent: fldNo, fldDate, fldNextDate How do I get the query to look at the next record to get the fldNextDate? Thanks! Rob B. Rob, One approach is: NextDate: DMin("[fldDate]","tblEvent","[fldDate]>#" & [fldDate] & "#") -- Steve Schapel, Microsoft Access MVP Rob B. wrote: > I have a table that contains an event nu...

using excel to calculate win-loss records
If i have an excel spreadsheet detailing my sports program's win-loss records, i have a column titled "W/L"...and a "W" if they win and an "L" if they lose. Is there a formula that would total the amount of "W"'s and "L"'s and display it in a traditional Win-Loss format? (ie Wins-Losses, or for example 3-14) Any help would be appreciated. if your W or L range is c5:c11 this should work =CONCATENATE(COUNTIF($C$5:$C$11,"W"),"-",COUNTIF($C$5:$C$11,"L") -- duan -------------------------------------...

Inserts specific siggy
If I have a list of signautres configured in Outlook, I can't see a way to insert one of them into an email. I can only see how to auto-insert them on New Message, or Reply Message Is there a way to insert different siggys (like you can with OE) Many thanks (man I'm loving the new feature set in 2003) == Phil WordMail does not include an Insert | Signature command like the regular = Outlook editor. If you want to be able to insert a signature into a = WordMail message manually, you can create an AutoText entry for each = signature. You can then insert them with the Insert | Aut...

Inserting line breaks into merged text cells.
Hi, I have about 60000 mail recipiants on an excel list thats in the form of a1,b1,c1,d1,e1,f1. Which is just the mailing address for 1 person. Now I'm trying to get the row of cells into one cell so I can paste them into labels in a word document. Avery 5163 to be exact. So i've been trying to use concatenate(a1,b1,c1,d1,e1,f1) to make it into a mail form but I can't figure out the command for line breaks. Can you add a line break to a formula to add text? If not.. does anyone have an answer? I'm using outdated software (Office 2000). Thanks for your time. Don&...

How do I insert files?
I need to insert .pdf file etc. into the page so that people viewing them can download them. How do I do this? Refer to item 11 at the following link: -- Brian Kvalheim Microsoft Publisher MVP ~pay it forward~ This posting is provided "AS IS" with no warranties, and confers no rights. "idratherbeout" <> wrote in message >I need to insert .pdf file etc. into the page so that people vi...

Record is locked (deadlock was detected)
when trying to run a CM Transaction I get "A get/change next operation on table 'CM_Transaction' deadlock was detected. when I click on more details i am given the following. [microsoft][ODBC SQL Server Driver][SQL Server] Transaction (process ID 77) was deadlocked on thread | communication buffer resources with another process and has been chosen as the deadlock victim. Return the transaction. currently I have ensured that no one is logged in. I view the odb.dex_lock table in the tempDB and cleared it. At this point I can run a reconciliation with no errors where I ...

Inserting Rows into multiple worksheets
I have a number of linked worksheets & would like to know if its possible & how, to insert a row into one sheet it will auotmatically insert a row into the corresponding linked sheet with the same formatting. Ideally it might also allow for automatically updating the numbering (in the 1st column) similar to when inserting number bullets in word. Any suggestions & help appreciated Are you talking about separate files or multiple worksheets in the same file? If it's the latter, If you hold down the shift or control key and click on the tab for each worksheet you...

Inserting Quotation Marks in all Cells
Hi! I have a co-worker who needs to insert quotation marks in the entire worksheet. It contains both numbers and text. The quotation marks need to be inserted around each individual cells data. Can someone help? Enter this small macro: Sub quoteit() Dim r As Range For Each r In Selection If IsEmpty(r.Value) Then Else r.Value = Chr(34) & r.Value & Chr(34) End If Next End Sub Select all or some portion of the worksheet and run the macro. It will put quote marks before and after the contents of all selected non-empty cells -- Gary's Student "confused" wrote: ...

Hi All, could somebody navigate me to SDK, where is explained following case: I have created my own entity, when i use contant as lookup and i need to automatically fill different field with value from Contact related field. I don't create new record in my own entity from contacts. Is there some example how to do it? Thanks a lot Radek Radek, You cannot do this via a mapping. You will need to write a callout to retrieve the values required from contact onCreate of the custom entity record. There is a callout sample in the SDK for your reference. HTH, Niths "Radek Novak&qu...

Updating a certain number of records on a table
I have a table with 100 records. One of the fields on the table is EmployeeName. I want to update 75 records to have EmployeeName "Robert" and the other 25 to have EmployeeName "Gina". Is there a way to do this? Thanks! If it doesn't matter which records, first limit the returns to 75 records. The SELECT TOP 75 can do this. You want to use a unique field, such as the primary key, or you may get extra records if there are duplicates for the 75th record. Then using that query as the subquery. Joining on the primary key would be best. It would look s...

CRM 3.0 for current customer...when do I get this?
I have an active service agreement, but still haven't received CRM 3.0, even though I've read here that it shipped December 6. Also, it's not available for download from Customer Source and we're still listed as being licensed for 1.2 only. Can anyone please explain the process for acquiring 3.0? Thank you. It depends on the type of Software Assurance you own (Enterprise licensees will receive the upgrade license and media automatically), but most SA licensees will have to ask their MBS reseller to order the license keys and media, for a nominal fee (shipping and hand...

"Insert Comment" macro--can't get rid of reviewing pane
I just recently got a new laptop and decided to try Office 2010 while I'm at it. I have a single, simple macro recorded with a key-combo saved to it that will insert a comment. I edit documents and spend MANY hours inserting comments. My macro is simple: Insert Comment. That's it. I just do Alt-W and voila! The comment is inserted, ready for me to type my text into it. In Word 2003, it inserts nicely and neatly. However, in trying to create this same macro in Word 2010, when I actually go to run the macro, it ALWAYS opens up the reviewing pane at the bottom!! And ...

inserting a word document
Hi, I have created a excel workbook with about 6 pages, I need to include a letter I created in Word as one of the worksheets in the project. I tried to take the word letter and insert it as an object into my excel worksheet...this did not totaly work as I now have a line like a border around this letter. If any one can please help me, just email me at and put excel in the subject line. I would so appreciate any help I can get on this matter. Thanks much Annmarie Have you tried creating a text box that covers the whole sheet, then inserting the Word document int...

How do I insert the date the file was saved in the MS Excel foote.
I am trying to display the date the file was last saved in the footer field. the defualt date code displays the date the file was printed. I would appreciate any help with this. Hi kacate Try -- Regards Ron de Bruin "kacate" <> wrote in message >I am trying to display the date the file was last saved in the footer field. > the defualt date code displays the date the file was printed. I would > apprec...

Function or insert/into temp table
I have rewritten a function that calls a function recusively that passes back a table from a stored procedure. It now seems that I have to call that procedure over and over from another list that I get from a common table expression. Something like: with MyCTE as { .... } INSERT INTO #Temp SELECT Account FROM MyCTE Read through #Temp and execute the stored procedure for each row. Is there a way to do this without a cursor? Thanks, Tom "tshad" <> wrote in message news:%23qfThagyKHA.244@TK2MSFTNGP06.phx.gbl... >I have re...

Inserting cover page in front of a template page
Version: 2008 Operating System: Mac OS X 10.6 (Snow Leopard) Processor: Intel Hi, <br><br>I'm preparing a proposal and using a template from my word project gallery. I want the template page to show up as page 2, so I can insert a cover page as page 1. (I don't want my logo from my template to show on the cover page) How can I insert a blank page first, to create my cover page, before my template page? <br><br>My template page 1 has my logo, and when I try to insert a cover page, it places it on top of my template. <br><br>Thanks for your help!...

inserting photos
I have created a spread sheet with the student demographics for our school. I want to include the student photos. I have the photos in a folder. I have a text file that matches student id numbers to photo names. What is the best (is there a best) way to proceed? Thanks, Jeremy On Feb 24, 1:02=A0am, "Jeremy Schubert" <> wrote: > I have created a spread sheet with the student demographics for our schoo= l. > I want to include the student photos. =A0I have the photos in a folder. = =A0I > have a text file that matches student id numbers to ph...

Copy and Insert Row
Hi, The excel vba code does not generate the correct result and incomplete as I've no idea on how to rectify the codes to achieve the intended results Below is the extract of vba codes : - =A0 Dim C As Range =A0 Dim X As Long =A0 Dim LastRowX As Long =A0 Dim LastRowY As Long =A0 Dim CellsToColor() As String =A0 LastRowX =3D Worksheets("Wrksheet X").Cells(Rows.Count, "A").End (xlUp).Row =A0 LastRowY =3D Worksheets("Wrksheet Y").Cells(Rows.Count, "A").End (xlUp).Row =A0 With Worksheets("Wrksheet X") =A0 =A0 ReDim CellsToC...

Can you find duplicate records in excel
I want to sort out duplicate SS#'s in a database I am working on. Can excel do that? Check Chip Pearson's site for help "Janet" <> wrote in message >I want to sort out duplicate SS#'s in a database I am working on. Can >excel > do that? ...

'new record' grayed out in query
Hello friends, I recently added a calcuation field to a query (in Access 2007 in a file saved to be compatible to Access 2003), and it even works. But now, the 'new record' field is greyed out in both the query and, of course, the attached form. But I can create a new field in the table. Help? The calculation field I added, in case it matters, is an Expression, titled 'FigureTax: ([PricePaid]*0.0876)' thanks so much - Mary -- Thanks for sharing your knowledge. Please provide the SQL view of the query. -- Duane Hookom Microsoft Access MVP &qu...