Checking if a dataset is empty

I use a session variable to store the data filled in three form pages registration. On every page I create a dataset with a table object in it and then I assign the dataset to the session.

If the user decides going back to the previous form page I want to refill all the form fields with the data stored in the session, now I am trying to do it thus on the second page: (in the case of user comes from the third page)

CODESub Page_Load(sender As Object, e As EventArgs)
If Not IsPostBack Then

Dim ds2 As DataSet
ds2 = CType(Session("UserData"), DataSet)
If Not isNothing(ds2.tables(0).rows(0)) then

name.Text() = ds2.Tables(0).rows(0).Item("companyName").ToString
state.SelectedValue = ds2.Tables(0).rows(0).Item("State").ToString
city.SelectedValue = ds2.Tables(0).rows(0).Item("city").ToString

End If

End If

End Sub
But I receive this error just when I come normally from the first page to the second:
System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Line 73: state.SelectedValue = ds2.Tables(0).rows(0).Item("State").ToString

I don t understand this error because the subroutine says that only set the values from the session to the form fields if the data exists in the dataset: 'If Not isNothing(ds2.tables(0).rows(0)) then'. And if I come from the first page the dataset of the second page it doesn t exists yet...

Somebody knows what is the problem

On the first form page:
CODESub userData(Sender As Object, e As EventArgs)

Dim ds As New DataSet()
Dim dt As New DataTable()

Dim row As DataRow
row = dt.NewRow()
row.Item("Mail") = mail.Text
row.Item("Password") = password.Text
row.Item("userType") = userType.SelectedItem.Value
row.Item("zipCode") = zip.Text

Session("UserData") = ds

End Sub
On the second form page:
CODESub userData(Sender As Object, e As EventArgs)

Dim ds2 As DataSet
ds2 = CType(Session("UserData"), DataSet)

Dim row As DataRow
row = ds2.Tables(0).Rows(0)
row.Item("companyName") = name.Text
row.Item("State") = state.SelectedItem.Value
row.Item("City") = city.SelectedItem.Value

Session("UserData") = ds2


End Sub
Thank you

Posted On: Wednesday 2nd of January 2013 01:43:42 AM Total Views:  465
View Complete with Replies

Related Messages:

too many arguments specified????   (140 Views)
I am getting this wrror. I am not sure why....Procedure or function GetSingleQuoteSendQuoteInfo has too many argumentsspecified. Public Function GetQuoteSendQuoteInfo(ByVal QuoteCookieID AsString) As Integer ' Create Instance of Connection and Command Object Dim myConnection As NewSqlConnection(ConfigurationSettings.AppSettings("connectionString")) Dim myCommand As New SqlCommand("GetSingleQuoteSendQuoteInfo",myConnection) ' Mark the Command as a SPROC myCommand.CommandType = CommandType.StoredProcedure ' Add Parameters to SPROC Dim parameterQuoteCookieID As New SqlParameter("@QuoteCookieID",SqlDbType.NVarChar, 50) parameterQuoteCookieID.Value = QuoteCookieID myCommand.Parameters.Add(parameterQuoteCookieID) Dim parameterID As New SqlParameter("@id", SqlDbType.Int, 4) parameterID.Direction = ParameterDirection.Output myCommand.Parameters.Add(parameterID) ' Open the database connection and execute the command myConnection.Open() myCommand.ExecuteNonQuery() myConnection.Close() ' Return the datareader Return CInt(parameterID.Value) End FunctionSP......CREATE PROCEDURE GetQuoteSendQuoteInfo(@QuoteCookieID nvarchar(50),@Expr1 nvarchar(20) OUTPUT)ASSELECT@Expr1 = COUNT(*)FROMtempQuoteINNER JOINtempQuoteDetail ON tempQuote.tempQuoteID = tempQuoteDetail.tempQuoteIDWHEREtempQuoteQuidID = @QuoteCookieIDGO
uping Ajax Update Panel   (107 Views)
I have three panels on a page: panel_A has a gridView gv1 with PageSize = "5" OnRowCommand = "LoadCompanyInfo" OnPageIndexChanging="gridView_PageIndexChanging1" Panel_B has gridview gv2 with PageSize = "5" OnRowCommand = "SelectEmployee" OnPageIndexChanging="gridView_PageIndexChanging2" Panel_C has labels CompanyID, CompanyName, EFirst, ELast and EMiddle. Panel_A panel_B and panel_C are in an update panel. Each row in gv1 is a LinkButton, so if I click on a row, it runs a method 'LoadAccount' which updates the labels in panel_C and also populates the gridview on panel_B. This part is working fine, when I click on a row in gv1, it updates the labels text in Panel_C and populates gv2 in panel_B. I am having the following issues: 1.When I click on a row in gv2, it makes the labels text in panel_C blank and gv2 also becomes blank, shows EmptyDataText. I expect it to just update EFirst, ELast and EMiddle. in panel_A. 2. When I click on the next page no on gv1 it fires LoadCompanyInfo method first and then goes in the gridView_PageIndexChanging1 event. I expect it to go in the gridView_PageIndexChanging1 event only and show next page in gv1 and not in LoadCompanyInfo , because I am just clicking on page no 2 not row 2. 3. gv1 refreshes on a timer event OnTick = Timer_Tick, and it clears off data in panel_B and panel_C. I want it to just update panel_A. I guess I will have to set up nested Update panels to accomplish this. I would appreciate if I can get help on setting these nested update panels on this page to accomplish the above 3 issues. Thank you.
problem with the reference to the AjaxControlToolkit   (142 Views)
I have a problem with a project I am developing in VS 2008. I added a reference to the AjaxControlToolkit in my project. I then go into the html source to add the ajax control to my page and it is giving me error messages saying that "ModalPopupExtender is not a known element" I have a statement to register the assembly at the top of the page. Has anybody else had this problem too. I would appreciate any help with issue
Email Contact Form   (144 Views)
Alright, so I have this contact form and everything shows up just fine, and it acts like it sends email, but I am not recieving anything... I am not sure what is going on - so help is appreciated. Here is my code: protected void SendMail(Object sender, EventArgs e) { MailMessage mail = new MailMessage(); mail.From = new MailAddress(""); mail.To.Add(tbEmail.Text.ToString); mail.Subject = tbSubject.Text.ToString; mail.IsBodyHtml = true; mail.Body = "Name: " + tbName.Text.ToString + ""; mail.Body += "Operating System: " + OSDropDown.Text.ToString + ""; mail.Body += "Application Name: " + appDropDown.Text.ToString + ""; mail.Body += "Question/Comment:      " + tbBody.Text.ToString + ""; SmtpClient smtp = new SmtpClient(); smtp.Host = ; smtp.Send(mail); } protected void Reset(object s, EventArgs e) { } ----Select One---- Windows 7 32-Bit Windows 7 64-Bit Windows Vista 32-Bit Windows Vista 64-Bit Windows XP 32-Bit Windows XP 64-Bit ----Select One---- Deck Designer (Do-It-Yourself) Fence Designer (Do-It-Yourself) Garage Designer (Do-It-Yourself) Post Frame Designer (Professional) Deck Designer (Professional) Fence Designer (Professional) Garage Designer (Professional) Post Frame Designer (Professional)
Ajax MaskedEditExtender not displaying mask   (195 Views)
Okay, this is really throwing me and making me feel crazy. I'm sure I'm missing something dumb. I'm building an account registration form, and I want to put a mask on the phone number textbox, i.e. XXX-XXX-XXXX. I'm using the AjaxToolkit MaskedEditExtender and MaskedEditValidator. The validator actually does display it's error message, but there is no mask on the textbox. I have the toolkit registered in the web.config, and everything else I'm using from it works fine. I did notice that I can't drag-and-drop the maskededitextender into the form, which seems odd: the maskededitvalidator dropped in fine. Here's the table cell that has the phone number controls: I'm really at a loss as to what's going on, and I'm beginning to wonder if it's an issue with the page or the toolkit assembly, or maybe just doesn't like me anymore.
IIS6 Not configured for .Net - Framework is installed   (273 Views)
A client of mine has Windows Server 2003..Net Framework 1.1 is installed.IIS6 is not configured to run .Net apps, the ISAPI mappings have no .aspx or .ascx and all the other files types for .net.In IIS6 is there a way to configure IIS without having to uninstall the .net framework an re-installing it
Fill DropDownList in EditItemTemplate   (175 Views)
I'm trying to programatically fill a dropdownlist that is an the EditItemTemplate of a DataList. I've tried to bind the data in the Edit Command event handler, but this handler only has access to controls in the ItemTemplate, not the EditItemTemplate. Does anyone know how and when to bind the dropdownlist
Textbox in ListBox/DropDownList possible?   (160 Views)
Is it possible to have a textbox situated at the bottom of an ASP.NET DropDownList (runat=server) I figured this would be a good way to allow entry of text fields in a "Other" textbox inside the DropDownList when the listbox entries do not show what is needed
Summing a datagrid column???   (145 Views)
I've got a dataset and i bound to a datagrid. in this datagrid there is 17 columns. I want to summing a datagrid columns and show the result in footer. i tried the code i write below but i couldn't get the result:(int x1 =e.Item.ItemIndex;int x2 = DataGrid1.Items[x1-1].DataSetIndex;string name = ds.Tables[0].Columns[x2].ColumnName;for (int i=0 ;i < e.Item.Cells.Count;i++){if(name!=null && name.CompareTo("KolonOne")!=0){if (e.Item.ItemType== ListItemType.Item ||.Item.ItemType== ListItemType.AlternatingItem){Sum[3] += Convert.ToInt64(DataBinder.Eval(e.Item.DataItem,"GVM")); e.Item.Cells[3].Text+=e.Item.ItemType.ToString();}else if (e.Item.ItemType== ListItemType.Footer){e.Item.Cells[3].Text = String.Format("{0:#,###}",Sum[3]);}}}
Query to Advantage DB is timing out   (154 Views)
I have an Advantage (yeah right) db that I'm trying to connect and query to but when I run it just times out. Below is my connection string in case I'm doing it wrong
Price compare site   (81 Views)
I need some advice on how-to do a project. What I'm doing is a price compare book site for a college. I'm not sure on how to retrieve the data from other sites and populate a table. I know some sites will give me data access to their inventory, but how do I put all the data together Into an XML file or a dataset, or something else I have never done this before, so any suggestions would be helpful. It will be like www.isbn.netJim What doesn't kill you makes you stronger.
GDI+ Bitmaps, potential canvas(es)   (107 Views)
Which controls within can contain, and display, a Bitmap object, other than the Response.Outputstream (ie, the page itself)I'm doing some GDI+ drawing on a Bitmap object, which I like to pass to a valid receiver.It would make sense to me that for instance an asp:image can contain this Bitmap, but from what I found, it doesn't look like it.Any ideas
Static class vs Session object   (115 Views)
Am I correct saying that with ASP.Net, a static class, is basically a single server object, that is active across sessionsMeaning that if I set a value of a static class, all sessions will read the same value. But that means that if one user's session sets this value again with something new, EVERYONE will read this new value, not the old one.What I'm getting at is that I'd like to use something along the lines of: CODEstring text = StaticClassName.SomeValue;I just think it's way cleaner than:CODEstring text = Session["SomeValue"].ToString();Particularly because I don't need the cast with a static method. But, I think the nature of a static class (as I described above) makes this impossible, as it will return 'server' values, instead of 'client' (read: session) variables.Any ideas/suggestions about this
Basic Update Question   (133 Views)
I am new to I am creating a .net page which helps update information in an ACCESS database. No I can't upgrade to SQL Server at this time. I have a page which I open a open a reader and populate information on a form. I want the users to be able update any of the information on the page. Some of the data contains text boxes which contain 255 characters. Since the page is populated using a query, I have to update the tables individually. I have one page I am using. I have one Sub to populate data and then was going to call another sub on the onclick update event. I have passed a few hidden text boxes to make sure I know which tables passed data from the query. Is the only way to update an Access database by using the ExecutNonQuery and creating an update query stringCODE "update table set x='" & txt.text & "' where x='"&hiddentxt.text&"''Also if I want to see if the text box has changed from the original value populated, do I have to store each value in a session variable and see if it has changed before I invoke the update query
Create rtf file and display on client.   (162 Views)
What I am trying to do is to read an rtf file, replace some text with text from a database (name and address etc), save it to a folder and display it in word on the user's pc. To display the file I am shelling to it using a couple of lines of javascript. The code that reads, modifies and writes the file saves the path to the file in a textbox. This I hoped the javascript could use.Doesn't work. I think that the javascript sub is running before the database related code so there is no path to shell to.Does that seem likely If so, how can I do this I've been struggling away for ages at it. the individual bits work, just the link from the created filename and the javascript on the browser is not working. , OK, I have found your code to do that.If I change from pdf to rtf how does the file end up in ms word I don't understand.
Iterate cells in datarowbound event   (91 Views)
I'm using conditional formatting in a gridview. I want to be able to iterate the cells in that specific row. What I have below works, but was wondering if there is a collection available so I can use foreach instead.
Encoding data securely   (185 Views)
i'm coming from a php background where everytime i posted a variable back to the server i would wrap in a function before passing into my sql statement. This allowed me do a replacement for html entities and also a mysql fix to avoid sql injections.With if i use parameters i avoid any sql injections but i still have problems with html entities.Say in the edit profile area of my site i have a formview which uses 2 way databinding and contains a textbox for the user's first name. Then say i wrap the value (when posted back) with Server.HtmlEncode before updating the value in the database. If the user entered
Best way of designing this code   (198 Views)
The problem ( done in .net1.1).Ive been asked to do some work on a site that uses a number of webservice calls.Currently, there is a web page that kicks off an asynch call to a Web service.The site then redirects to a results page, where it has some javascript that forces it to post back X seconds, where the code on PageLoad checks a database to see if the service has finished executing and has written the result set to the databaseI have been asked to take what is currently being used and extend it, so that on page 1 it makes multiple calls to the webservice, then redirects to page 2 To my mind the whole setup seems inefficient, so I want to propose some changes. Before I do, I need to check my thinking, and get it right in my own head.The simplest approach is to leave the pages as they are, and adding more network traffic (the 5 service calls, then the 5 * n calls to the database until the results are in)But one of the concerns is the amount of traffic that this will cause on the network, and the performance if there are a lot of people using this at the same time (Lots of postbacks triggering lots * 5 database calls)To make it smarter Im thinking of having a manager class that relates the sessionID to a callbackHandler class. When the webservice is complete I will then trigger the database call to pull back that portion of the results, and store that in a dataset in the object.I still get a postback every x seconds, but then all that is doing is forcing the page to rebind to the dataset to display the results, to my mind reducing the traffic to the database significantly.So, can anyone offer any critique of what Im planning to do, and secondly, is there a way I can trigger a page refresh / postback from the server, so I dont even need to have a javascript timer on the client (which seems dodgy to me, as if js is disabled, then the page will never show its results!)I know this may be a bit "moon on a stick", which is why Ive left the option of doing it the current way.K
How to launch a ASP page by coding   (110 Views)
I am an experienced VB6 developer and I am learning ASP.NET/VB.NET. I am building a Web search interface for our Intranet and I would like to know how to load another ASP page from the code. I have a Login page linked to an SQL database to authentify the user when the button 'cmdLogin' is pressed. There is a call to a StoredProc that will return an error message if the credentials are invalid, otherwise it returns 'ALLOWED' Here is the code so far:Protected Sub cmdLogin_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdLogin.Click 'Refresh the SQL connection sqlLogin.DataBind() 'Refresh the DataView control detView.DataBind() If detView.Rows(0).Cells(1).Text = "ALLOWED" Then Else detView.Visible = True txtUserName.Focus() End If End SubIf it is 'ALLOWED', I need to launch a ASP pag
Changes in Web Site Administration Tool raises error   (462 Views)
I am a new user of Visual Web Developer 2005 Express Edition.In Web Site Administration Tool, every try to change something on Security tab or Application tab, raises following error message:Attempted to perform an unauthorized operation. at System.Security.AccessControl.Win32.SetSecurityInfo(ResourceType type, String name, SafeHandle handle, SecurityInfos securityInformation, SecurityIdentifier owner, SecurityIdentifier group, GenericAcl sacl, GenericAcl dacl) at System.Security.AccessControl.NativeObjectSecurity.Persist(String name, SafeHandle handle, AccessControlSections includeSections, Object exceptionContext) at System.Security.AccessControl.NativeObjectSecurity.Persist(String name, AccessControlSections includeSections) at System.Security.AccessControl.FileSystemSecurity.Persist(String fullPath) at System.IO.File.SetAccessControl(String path, FileSecurity fileSecurity) at System.Configuration.Internal.WriteFileContext.DuplicateTemplateAttributes(String source, String destination) at System.Configuration.Internal.WriteFileContext.DuplicateFileAttributes(String source, String destination) at System.Configuration.Internal.WriteFileContext.Complete(String filename, Boolean success) at System.Configuration.Internal.InternalConfigHost.StaticWriteCompleted(String streamName, Boolean success, Object writeContext, Boolean assertPermissions) at System.Configuration.Internal.InternalConfigHost.System.Configuration.Internal.IInternalConfigHost.WriteCompleted(String streamName, Boolean success, Object writeContext, Boolean assertPermissions) at System.Configuration.Internal.InternalConfigHost.System.Configuration.Internal.IInternalConfigHost.WriteCompleted(String streamName, Boolean success, Object writeContext) at System.Configuration.Internal.DelegatingConfigHost.WriteCompleted(String streamName, Boolean success, Object writeContext) at System.Configuration.UpdateConfigHost.WriteCompleted(String streamName, Boolean success, Object writeContext) at System.Configuration.MgmtConfigurationRecord.SaveAs(String filename, ConfigurationSaveMode saveMode, Boolean forceUpdate) at System.Configuration.Configuration.SaveAsImpl(String filename, ConfigurationSaveMode saveMode, Boolean forceSave) at System.Configuration.Configuration.Save(ConfigurationSaveMode saveMode) at System.Web.Administration.WebAdminPage.SaveConfig(Configuration config) at ASP.security_setupauthentication_aspx.UpdateAndReturnToPreviousPage(Object sender, EventArgs e) at System.Web.UI.WebControls.Button.OnClick(EventArgs e) at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)I use network SQL Server 2K. Database ASPNETDB has been created using utility aspnet_regsql.exe, and I changed web.config accordingly.Testing connection to AspNetSqlProvider is OK.What else can be the problemThanx in advance for your suggestions.
javascript for maintaining vertical position in code behind   (107 Views)
yes, I know I posted this concerning a recent post, but what was with a control I found on the web.I'm now trying it on my own.Here's what I have in my HTML:*****************************************************************For my code behind, I've got the following in the page_load event:If Page.IsPostBack ThenResponse.Write("location.href="" temp_href=""#"""";")End If...tried this too, and no luck for the page_load event:***********************************************************************If Page.IsPostBack ThenDim strScript As StringstrScript = ""strScript = strScript & "location.href=""#"";"strScript = strScript & ""Page.RegisterStartupScript("ClientScript", strScript)End IfAny suggestions are welcome
Should I use a panel????   (84 Views)
I am fairly new to ASP.NET (actually pretty new to web development)Any way, what I have is a webpage with a ascx at the top for a header, a treeview going down the left hand side of employees, what I am trying to do is when you pick one the employees in the tree their details will show up in on the right hand side of the tree. Using a multiview because the will be different pages of details.When I just put in a multiview their details diplay under the tree not the righthand side.My question is should I put the details on a seperate page and then display that page in a panel.Or what would be the best way to do this...
OnClientClick with no postback   (139 Views)
Can someone tell me how to stop postback of an asp:linkbuttonNormally I would do this in the page load - btn.Attributes.Add("OnClick", "return false"), however this button is inside a gridview and I would really like to be able to set this in the html of the page. I tried OnClick="return false" but that gives an error because it can't find the sub. I think I've seen this before, but I can't remember how. Any thought
Create Folder on Server?   (100 Views)
Can anyone provide an example of how to create a folder on the server from within an ASP application (When the user sets up a new project, I want to create a folder on my server with a default set of folders based on the project number automatically).I saw some information about the filesystem object and all that, but it seems to be using COM or something. What's the clean easy way in 2.0 :) lol
ASP.NET + Outlook 2003 Contact Information   (185 Views)
Hi everybody,I am desparate, I can't get this code to work from an ASP.NET webpage.Problem is when I try to retrieve contact information and I get to MyDataRow("Tel.") = MyContact.BusinessTelephoneNumber, My App just hangs. I think it is because normally a dialog box would open up and say that an external program is trying to "connect" to outlook and if I want to allow it.Does anybody know a workaroundThank you in advance,MyOutlook = New Outlook.ApplicationMyNamespace = MyOutlook.GetNamespace("MAPI")Dim MyOutlookProcess() As ProcessMyOutlookProcess = Process.GetProcessesByName("OUTLOOK")If MyOutlookProcess.Length > 0 ThenMyNamespace.Logon(Nothing, Nothing, True, False)ElseMyNamespace.Logon(Nothing, Nothing, True, True)End IfMyContactFolder = MyNamespace.GetFolderFromID(GlobalSettings.SelectedContactFolder)MyContactDataTable = New DataTable("Kontakten")MyContactDataTable.Columns.Add(New DataColumn("Select", System.Type.GetType("System.Boolean")))MyContactDataTable.Columns("Select").owDBNull = FalseMyContactDataTable.Columns.Add(New DataColumn("Objekt-Nr."))MyContactDataTable.Columns.Add(New DataColumn("KundenTyp"))MyContactDataTable.Columns.Add(New DataColumn("Firma"))MyContactDataTable.Columns.Add(New DataColumn("Strasse"))MyContactDataTable.Columns.Add(New DataColumn("PLZ"))MyContactDataTable.Columns.Add(New DataColumn("Ort"))MyContactDataTable.Columns.Add(New DataColumn("Name"))MyContactDataTable.Columns.Add(New DataColumn("Geburtstag"))MyContactDataTable.Columns.Add(New DataColumn("Vorname"))MyContactDataTable.Columns.Add(New DataColumn("Abteilung"))MyContactDataTable.Columns.Add(New DataColumn("Tel."))MyContactDataTable.Columns.Add(New DataColumn("Fax"))MyContactDataTable.Columns.Add(New DataColumn("Mobil"))MyContactDataTable.Columns.Add(New DataColumn("Mail"))MyContactDataTable.Columns.Add(New DataColumn("Internet"))MyContactDataTable.Columns.Add(New DataColumn("Bemerkungen"))MyContactDataTable.Columns.Add(New DataColumn("InDB"))If SelectedInDB = "Nein" ThenSelectedInDB = "N"ElseSelectedInDB = "J"End IfFor Each MyContact In MyContactFolder.ItemsDim ObjectID As String = ""Dim InDB As StringDim KundenTyp As StringDim PropertyNumber As StringTryIf Not IsNothing(MyContact.ItemProperties("ID").Value) ThenObjectID = MyContact.ItemProperties("ID").ValueElseObjectID = i & "T"End IfCatch ex As ExceptionObjectID = i & "T"End TryTryIf Not IsNothing(MyContact.ItemProperties("InDB").Value) ThenInDB = MyContact.ItemProperties("InDB").ValueElseInDB = "N"End IfCatch ex As ExceptionInDB = "N"End TryTryIf Not IsNothing(MyContact.ItemProperties("KundenTyp").Value) ThenKundenTyp = MyContact.ItemProperties("KundenTyp").ValueElseKundenTyp = ""End IfCatch ex As ExceptionKundenTyp = ""End TryIf SelectedKundenTyp = "" Or KundenTyp = SelectedKundenTyp ThenIf InDB = SelectedInDB ThenDim MyDataRow As DataRowMyDataRow = MyContactDataTable.NewRowMyDataRow("Select") = FalseMyDataRow("Objekt-Nr.") = ObjectIDIf KundenTyp.Trim = "" ThenMyDataRow("KundenTyp") = ""ElseMyDataRow("KundenTyp") = DBKundenTyp.GetKundenTypBeschreibung(KundenTyp)End IfMyDataRow("Firma") = MyContact.CompanyNameMyDataRow("Strasse") = MyContact.BusinessAddressStreetMyDataRow("PLZ") = MyContact.BusinessAddressPostalCodeMyDataRow("Ort") = MyContact.BusinessAddressCityMyDataRow("Name") = MyContact.LastNameMyDataRow("Geburtstag") = MyContact.BirthdayMyDataRow("Vorname") = MyContact.FirstNameMyDataRow("Abteilung") = MyContact.DepartmentHere it just hangs and nothing happens anymore --> MyDataRow("Tel.") = MyContact.BusinessTelephoneNumberMyDataRow("Mobil") = MyContact.MobileTelephoneNumberMyDataRow("Fax") = MyContact.BusinessFaxNumberMyDataRow("Mail") = MyContact.Email1AddressMyDataRow("Internet") = MyContact.BusinessHomePageMyDataRow("Bemerkungen") = MyContact.BodyMyDataRow("InDB") = InDBMyContactDataTable.Rows.Add(MyDataRow)End IfEnd Ifi += 1Nextdatagrid1.DataSource = MyContactDataTabledatagrid1.DataBind()Catch ex As ExceptionMyNamespace.Logoff()MyOutlook.Quit()Exit SubFinallyMyNamespace.Logoff()MyOutlook.Quit()datagrid1.Visible = TrueEnd Try /Peace2u
Confused over data display   (99 Views)
HiI have an xml document read by an xmldatasource.Bound to this is a repeater.I have a button - in the click event I want to add an element to the xml doc and redisplay in the repeater.I have the new element being added OK, but it's hit & miss whether the just added item appears in the repeater. Seems to be every other postback, but sometimes every postback.Probably something to do with when/how I'm rebinding. I'd appreciate your assistance.CODE Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load xmlDSBACSPayment.DataFile = "\\ldnps0001\daar01$\Visual Studio 2005\WebSites\WebSite1\Payments\BACS\" & Date.Today.ToString("yyyyMMdd") & ".xml" xmlDSBACSPayment.DataBind() rptPayments.DataBind() End Sub Protected Sub btnSavePayment_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSavePayment.Click 'add the new payment detail into the xml file & display Dim myXml As New System.Xml.XmlDocument myXml.Load(xmlDSBACSPayment.DataFile) Dim path As String = "bacs/payments" Dim paymentsNode As System.Xml.XmlNode = myXml.SelectSingleNode(path) Dim elem As System.Xml.XmlElement = myXml.CreateElement("payment") Dim attr As System.Xml.XmlAttribute = myXml.CreateAttribute("beneficiaryname") attr.Value = "benename" elem.Attributes.Append(attr) Dim attr2 As System.Xml.XmlAttribute = myXml.CreateAttribute("amount") attr2.Value = "0.00" elem.Attributes.Append(attr2) Dim attr3 As System.Xml.XmlAttribute = myXml.CreateAttribute("sortcode") attr3.Value = "203507" elem.Attributes.Append(attr3) Dim attr4 As System.Xml.XmlAttribute = myXml.CreateAttribute("accountnumber") attr4.Value = "888888" elem.Attributes.Append(attr4) Dim attr5 As System.Xml.XmlAttribute = myXml.CreateAttribute("reference") attr5.Value = "the ref" elem.Attributes.Append(attr5) Dim attr6 As System.Xml.XmlAttribute = myXml.CreateAttribute("order") attr6.Value = "the order" elem.Attributes.Append(attr6) paymentsNode.AppendChild(elem) myXml.Save(xmlDSBACSPayment.DataFile) xmlDSBACSPayment.DataFile = xmlDSBACSPayment.DataFile xmlDSBACSPayment.DataBind() rptPayments.DataBind() End Sub
Session State and Webservices   (112 Views)
In my global asax I have: protected void Global_AcquireRequestState(Object sender, EventArgs e) { // set the security principal to our BusinessPrincipal if(Session["CSLA-Principal"] != null) { Thread.CurrentPrincipal = (IPrincipal)Session["CSLA-Principal"]; HttpContext.Current.User = Thread.CurrentPrincipal; } }If I navigate to a webservice, I get the error:Session state is not available in this context. I need the session code in my global.asax file for the rest of my site, but it seems to be causing issues with webservicesWhat am I doing wrong
Replace string in Response   (78 Views)
Can anyone tell me how I can replace a string in the Response And in which event to do this.I have a 3party tool that injects some javascript function into the page. I want to filter this function
Compare effeciency   (160 Views)
i have a table like thisUserId Score1 152 301 452 50This is the basic SQL i run to get the score per user:select UserId,count(Score) from Table1 group by UserIdNow i want the Total Score(=15+30+45+50) also in the resultset (AS i need to calculate the %).i.e. i am looking for a display like this:UserId Score Total1 15 1402 30 1401 45 1402 50 140I can do this in either SQL server or in .NETIf i do this i SQL i would write something like this:select * from (select UserId,count(Score) from Table1 group by UserId) Table1Left Join(select count(Score) from Table1 group by UserId) Table2on 1=1How effecient is thisIf i have to use .NET then i have to use DataSets (as calculations with datareaders is difficult after the DataReader s bound)So the comparison i am making is calculating in .NET(Using a DataSet) Vs writing the query in SQL server... Known is handfull, Unknown is worldfull
Databind Problem w/ Label Object   (78 Views)
I am trying to get a lblName binded to a DataSet11. Specifically a Field on a Table named Written Name. I realized that there is a way to code this but I was trying to get it to work with Visual Studio .Net (Connection,Adapter,and DataSet). I have a SQLAdapter & DataSet Object but for some reason when I select the Databind Property on the label to Bind it, it allows me to find the Table and Column but won't place it in the property for use. I know this sounds strange so I can clarify if need be..if anyone has any suggestions I would appreciate it. Someone told me that I must code some of it out prior to trying this. However, this is not a diffilcult task and I think Visual Studio does all this for you...
Another Crystal Question   (80 Views)
Sorry for so many questions regarding crystal but here goes..How to do you connect a report to an SP or a dataset or reader any help would be appreciated
Refer parent function in custom control???   (183 Views)
i want to build a custom control that has a overridable function. This function can be overridden by the implementing page.e.g.:.ascx file has this functionpublic overridable FunctionName() as booleanend functionin .aspx i need to be able to override this function. like so:overrides FunctionName() as booleanresponse.write("Yeah!!!")end functionbut since the aspx file inhertis from page it is unable to override the custom control function.Can this be done I am open to other suggestions for implementing the same functionality... Known is handfull, Unknown is worldfull
Custom validation only works on localhost   (76 Views)
Hi . I got a custom validator that only seems to fire if i use my localhost. The minute i put it on the web server the validation stops fireing.Any ideas
whats wrong?? dataset expected type... (from a newby)   (91 Views)
. i am trying to learn!! but stuck here. gives me type expected" error for "dataset". couldnt understand... help..Public Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Dim ds As dataset = New dataset Dim tablo As New DataTable("customer") tablo.Columns.Add("name", System.Type.GetType("system.string")) tablo.Columns.Add("surname", System.Type.GetType("system.string")) tablo.Columns.Add("occup", System.Type.GetType("system.string")) tablo.Columns.Add("old", System.Type.GetType("system.int32")) 'ds.tables.add(tablo) Dim a As DataRow = tablo.NewRow a("name") = "abc" a("surname") = "cde" a("occup") = "fgi" a("old") = "29" 'tablo.Rows.Add(a) End Sub
Application Hangs Up on Pocket PC Only   (123 Views)
I have an ASP .NET web application that is used to scan parts for orders. I have tested with both a Windows XP Professional workstation using IE and a Pocket PC using Pocket IE. Basically, the process is to enter 3 text fields, either by scanning or typing, then press the "Add" button. The added parts are stored in a cookie on the client and then displayed in a DataGrid on the same page. These accumulate until another button is clicked. After "Add" is clicked for the 68th part, Pocket IE just sits there with the Windows logo moving; it will not continue. I have run the app in debug, and nothing appears to happen on the server side once "Add" is clicked. The Page Init, Load, and PreRender are not executed, and the button click procedure is not executed. I have checked this with Debug and Trace statements, as well as setting breakpoints in the code. I have also tried doing a "Break " at the point the app hangs, and I get the message "There is no source code available for the current location." There is no problem if the exact same test data is used on a Windows XP machine; it can add more than 68 parts. The Pocket PCs have 64MB of memory, and are connecting to the network via a wireless connection. Any ideas of what I can check next to find the problem Is there a limitation on the amount of data a Pocket PC can post back to the server Or a cookie size limitation on Pocket PC
Single record update - need advice   (170 Views)
I'm learning at the moment to develop my new websites. Iv'e used traditional asp for a number of years. I did a course on .net a few weeks ago and covered things such as datagrids, datasets etc. Iv'e managed to create datagrids that edit/update/delete records, and have forms to add a new record to an table in MS SQL in .net. The one bit I'm missing is where I want to update a single record where its number of fields is to big to fit in a datagrid row and therefore needs displaying in a single I have a record withTitle of workshopDescriptionStart dateEnd dateLinkTutorCommentsetc...What I did in asp was pass the ID of the record to an asp form read the database with a 'SELECT * FROM table WHERE ID=" + Request.QueruString("ID") which poulated the fields with the existing data in this record, the user then alters what they want and the data is written back to the table (theres only one administrator doing this so I don't have to worry about locking records etc). Where I get stuck in .net is how do I populate the fields Datasets seem too much for what is essentially reading just a single record, as does a datagrid. Really I want a form with a set of text fields and submit button, and someway of binding a single record field value to each of these fieldsFrom looking on the web it seems using a datatable might be the solution, but we didn't cover this is the course and its unclear to me the best way to get a single record into a datatable and then 'bind' it to each of the controls.The lack of data on the web suggests to me that I might not be understanding the .net paradigm rather than implementing. What is the best way of dealing with updating single records where the number of fields/size of fields is too big to display in a datagrid.The database I'm using is MS SQL Serve
How many layers are best practice?   (294 Views)
I occasionaly, while being in a deep "flow" of programming, run into these mind-design-problems, which i seem to forget but today i wrote one down. Suppose you have an item class, an item collection class, a dataclass (which fills the collection class with items stored in a database or flat file) and an e.g. "weblog" classto fill a collection you could instantiate the collection class in the weblog class as well as instantiate the dataclass in the weblogclass and fill it in the weblog class. In this way the collection class does not have to have a method called "fillme", which could be called to fill the collection class.On the other hand if the collection class would have a method called fillme it would make the weblog class much more simple since you would simply have to call something like weblogitemcollection.fillme and it would be filled... nog direct access needed to a dataclass whatsoever but... the single classes would be not so reusable since this specific dataclass in the collection class would always be needed.So you would have always have a item.cs, collection.cs, data.cs and weblogs.cs but the way you would call each other and which methods to include in each of these classes, in other words, the relations they have would differ.Another way would be to include an extra class, something like collectiondata.cs which would enable collection.cs to call something generic in collectiondata.cs to call data.cs.Which is the best way according to best practices --
asp / javascript checkbox enable/disable issue   (92 Views)
I have a 4 sets of checkboxes and text boxes on an aspx page. The checkboxes are disabled by default but when the text box next to it has text entered into it, the checkbox is supposed to enable.The problem is, the value is changed when I step through it in the debugger but the page is not. (checkboxes stay disabled on the page, but the value of checkbox.disabled = false)If i REVERSE this, making the checkboxes enabled by default and then try to disable them when text is entered, it works fine.Any suggestionsmy code looks like:CODE//elemArray[6] has checkbox.ClientID valuedocument.forms[0][elemArray[6]].disabled = false
Where is my .xsd file?   (113 Views)
I am reading one of my books on ADO.NET and it says that XML is automatically generated for me. Is this always the case I am connecting to SQL Server, so my question is... Is XML being used for the transfer I really don't know that much about ADO.NET, but I am going to attend a class on it in Feb. and help would be appreciated.
Linkbutton color   (85 Views)
How do I change the color of a LinkButton text.I am creating the linkbutton in code at run time.I only want to change the color of a particular button not the whole pag
Stream was not readable from mscorelib with BinaryReader with PDF   (103 Views)
I am getting error when I try to open PDF documdent using binary read. Line # 106 where error is occuring is binaryReader = New BinaryReader(HttpWResp.GetResponseStream())Error Source mscorlib : Stream was not readable. System.ArgumentException: Stream was not readable. at System.IO.BinaryReader..ctor(Stream input, Encoding encoding) at System.IO.BinaryReader..ctor(Stream input) at FileNetSearch.FileNetSearch.GetReport.ReturnPictureBinary(String sUrl, String& sContentType, String& sErrTxt) in c:\inetpub\wwwroot\SearchDoc\GetPDF.aspx.vb:line 106 Does anyone has any idea what is going worng in this.
Do you know the tool to create image for image button?   (102 Views)
I knew that most graphic software can do it. What I am looking for is a tool can create image for button, I can design what type, style, color and can type text on it easier. Anyone can recommend it
binding dropdown within datagrid   (89 Views)
I have a datagrid. The datagrid has a footer, and one of the columns in this footer is a dropdown list. ... I am trying to bind this dropdown list to a column in the databaseadd_attribute.DataSource = ds.Tables[0];add_attribute.DataTextField = ds.Tables[0].Columns["ss_attribute_name_c"].ColumnName.ToString();add_attribute.DataValueField = ds.Tables[0].Columns["o_id"].ColumnName.ToString();add_attribute.DataBind();BUT I get the error that the add_attribute could not be found. I guess it is because it is a part of the datagrid.How can I bind the dropdown within the datagrid with the column in the databaseAny suggestionsThank you,Marika
Uploading all files in a particular directory   (71 Views)
Is there a way to upload all files from a particular directoryI need the user to upload pictures so, instead of one-by-one uploading (using the file control), I would like the user to be able to point to a particular directory and click "upload" then, the app will loop for each jpg file and upload it.Is that even possible Let me put it this way:While StressLevel Is High Productivity -= 1 Marriage = NothingEnd While
data reader question   (81 Views)
Can somebody please tell me if I am going about this task the right way I have a recordset that I want to read and then perform a test and an update on each record in the recordset. Should I use a datareader to read the data and then a foreach loop to do my test and update And if so, what would the syntax of my foreach loop bestring strGetCartDetails = "SELECT S.PRODUCTID AS 'Product ID', "; strGetCartDetails += "'5.00' AS 'Unit Price (GBP)', S.SIPDOMAIN AS 'SIP Domain', "; strGetCartDetails += "S.QUANTITY as 'Quantity', C.SIPACCOUNT AS 'SIP Account', N.STARTRANGE, N.ENDRANGE "; strGetCartDetails += "FROM NUMBER_RANGES N INNER JOIN "; strGetCartDetails += "SHOPPING_CART S ON "; strGetCartDetails += "S.PRODUCTID = N.RECORDNUM "; strGetCartDetails += "INNER JOIN SHOPPING_CART_SIP C ON "; strGetCartDetails += "C.SCRECORDID = S.SCRECORDID "; strGetCartDetails += "WHERE S.CARTID = '" + strCartID + "' "; strGetCartDetails += "ORDER BY N.RECORDNUM"; SqlConnection objConnectionGetCartDetails = new SqlConnection(ConfigurationSettings.AppSettings["strConnectTest"]); SqlDataReader objDataReaderGetCartDetails = null; SqlCommand objCommandGetCartDetails = new SqlCommand(strGetCartDetails, objConnectionGetCartDetails); objConnectionGetCartDetails.Open(); objDataReaderGetCartDetails = objCommandGetCartDetails.ExecuteReader(); if (objDataReaderGetCartDetails.Read() == true) { //do foreach
sql server   (72 Views)
Hi to all,I have some basic knowledge of sql server and Now I would like to write a program that interacts between both. Can someone give me please some guidelines, how I should do this Should this special code be added to the code or sql server code Actually, I would like to read some input values through an page and initialize some fields of sql table. Furthermore, if someone knows useful links on the matter, please tell me
redirect to new link   (72 Views)
hi, below is the code, after login successful, i want to redirect the user to a new link. The code redirect back to http://localhost/test/ How can I redirect to
Problem turning of validator client side   (103 Views)
all,I am having trouble with a required validator. I have several validators on a page that are enabled or disabled depending on what is selected in a drop down box.To disable them client side, I use ValidatorEnable(ID, true/false). This works for all the validators I disable on the form.However, on the server-side when I perform a page.isValid it fails because one of this disabled validators is now considered not valid.I have having trouble figuring out why a disable validator returns isvalid = true client side and isvalid = false when it gets to the server side. I am not sure if posting any of my code will help or not
how to color a individual search word?   (101 Views)
I created a search app to search address and display in datagrid. I used dataset to bind to a datagrid. SQL statement like: "select [address] from TABLE_ORDER where [address] like '% " & strKeyword & "'. User can input "main st" or "Franklin"... to search address. I want to color the the "main st" or "Franklin"... How to code it