Jump to content
Xtreme .Net Talk

hsueh001

Members
  • Posts

    8
  • Joined

  • Last visited

hsueh001's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. This is for a WinForms environment. I am trying to create a ComboBox, that contains all the Countries in my database where I don't have to "hook" it up on every single form that it will be used. So I tried to do some inheritance, I inherited it from a ComboBox. In the constructor I simply connect to the Sql database and query a list of Id and country values. However when I drag this ComboBox into my WinForm I'm getting some code generation in the Designer.cs under the InitializeComponent(). The problem is the autocode generator generates two lines. this.comboBoxCountry.DataSource = ((object)(resources.GetObject("comboBoxCountry.DataSource"))); AND this.comboBoxCountry.Items.AddRange(new object[] { ((object)(resources.GetObject("comboBoxCountry.Items")))}); The order they are generated cause the second line to error. If I move the second line above the first, the error disappears. The error that I'm getting is: "Items collection cannot be modified when the DataSource property is set." Is there any way around this?
  2. Easiest way is when you do something like: datagrid.datasource = ds.tables(0) 'for the information in the first table returned with multiple columns (I assume you meant multiple columns? not rows) dropdownlist.datasource = ds.tables(1) 'for the information with one column for asp.net you must do the commands to bind the data datagrid.databind() dropdownlist.databind()
  3. Using buttons in the datagrid is a lot tricker. You need to use the datagrid's .ItemCommand event to handle buttons inside a datagrid. Typically inside the datagrid, for each button in the column you need to create a Template Column Similar to this: <asp:TemplateColumn HeaderText="Buy It"> <ItemTemplate> <asp:Button id=btnBuyIt runat="server" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "ItemKey") %>' CommandName="PurchaseItem">Buy It</asp:Button> </ItemTemplate> </asp:TemplateColumn> Then in the code behind. Have an event for the datagrid Private Sub dg_ItemCommand(ByVal source As System.Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles dg.ItemCommand Try If e.CommandName = "PurchaseItem" Then 'PurchaseItem is the commandName from the above coding in the datagrid 'Pass the information to paypal based on e.CommandArgument (Which from the above datagrid is going to be the ItemKey) End If Catch ex As Exception Throw ex End Try End Sub That should at least get you started in the direction you are looking for.
  4. In your "Accept" button event are you doing a check on If Page.IsValid then ... continue Else ... End If For some reason the custom validators seem to need this. I don't know if there's a way to associate the validator to the SelectedIndexChanged event. I've had to place it in the button I use to determine acceptance of the page.
  5. I've tried that. 95% of the time that DOESN"T do it. I still can't get rid of the temporary files. I can't figure out what is holding the #@*$(& lock on those files. These are the things I've tried... 1. Closing out of VS and reopening. 2. Killing the aspnet_wp process 3. restarting iis 4. restarting the local sqlserver Nothing seems to allow me to get rid of the temporary files. Anyone know of a way to determine what is locking those files? I'm at wits end. I'm rebooting my machine as frequently as 2-3x per hour as I'm coding and testing. And waiting for windows to reboot is not fun. But... so far a reboot is all I can do to get rid of the files. What sucks is if I reboot and forget to delete the files and start up VS and run the app. I get the same error... And have to reboot again. So I'm assuming the Temp files are some sort of cache. HELP!?
  6. I'm working with the DotNetNuke Portal application and coding my own module. Sometimes I get an error, and have determined that removing the files from the Temporary ASP.NET Files directory and re-compiling fixes the problem. The problem is I have to re-boot my computer each time to delete these files. Is there a way to delete the files from the Temporary ASP.NET Files directory without rebooting? Thanks!
  7. You never instantiated objUserFields Before your error add the line Dim objUserFields as New UserFields This should solve your problem.
  8. Problem with MS Access Database on server. "you need permission to view its data" I'm trying to access a MS Access Database on my company's Microsoft 2003 Server through an asp page. And I keep getting the error: The Microsoft Jet database engine cannot open the file 'xxxxxxx.mdb.' It is already opened exclusively by another user, or you need permission to view its data. Now since I'm only testing and I know no one else has opend the database. Also typically when you open the access database an .ldb file is generated in the same folder. No .ldb file exists so I'm pretty sure the db is not open exclusively by another user. I can open the database just fine directly across the network, so I know the database is not corrupt or bad. So I'm under the impression that the problem is I need permissions to view the data. I have searched around and some of what I have tried. 1. I have added the IUSR_<Computer Name> account on the network machine which contains the database and set the folder which the .mdb resides in so that the permissions of the folder for the IUSR_<Computer Name> user is Full Control (everything is checked under security) 2. I have turned on web sharing for this folder. 3. I have checked the permissions on the .mdb file. The permissions also have Full Control checked, but they are all grayed out also. I'm assuming the permissions are being inherited from the folder. I have not had any success. Has anyone else come across this. And what did you do to resolve the problem. Thanks.
×
×
  • Create New...