Jump to content
Xtreme .Net Talk

sj1187534

Avatar/Signature
  • Posts

    113
  • Joined

  • Last visited

Everything posted by sj1187534

  1. infact...it is strings like i told u....I really appreciate if you can show me a sample... Thanks SJ
  2. Hi.... I sure have a lot of questions today!!! I have a string (S1) of CSV type. And I have another string (S2) of the same type, i.e. it is also a string with csv values. Now, how can I check if any of the values in string S1 match with any of the values in string S2 ????? ~ SJ
  3. Hi...I have one more question.... Right now, I have a column DLoc in table T1. The DLoc currently has string values separated by a comma...like, T1 ====== ID -> 2 DLoc -> Dallas, Boston, Chicago ID is the primary key ================== Now, I want to create a table T2 that has two columns whose values are like this (obtained from T1): T2 ====== ID -> 2 Loc -> Dallas ID -> 2 Loc -> Boston ID -> 2 Loc -> Chicago (ID,Loc) is the primary key ==================== Any ideas on what is the best way to do this?? ~SJ
  4. Hi...I have a search engine that includes "search by location" functionality. The problem is when the user selects more than one from the listbox of locations, I have no way of searching those selected values in the database. Thats because, a single user in the database table has his desired locations as a string of locations from the locations listbox.... ex...in the database table, let's the user has his desired locations as Dallas, NewYork, Boston. Now, in the search engine , if the search in locations are selected as Dallas and Boston (passes to the SQl server as "Dallas,Boston"), how do I pass this in the SQL query??? I cant use the "charindex" as it can only check the whole "dallas,boston" string and not a part of it...... I cant use the "like" keyword also because the order of the words matters here... I hope you understand what I am talking about. Any help would be really appreciated... Thanks, ~SJ
  5. Hi.... How can we call a VBScript function in the HTML page from a code-behind file?? let me explain what i exaclty want... I am trying to implement a functionality that highlights the keywords that I pass through a query string. So, I got a vbscript function from the web that does that. I have to include this script code on the HTML side of the, say, InfoPage to perform the highlighting. Now, when I am done loading this InfoPage, I want to perform the highlighting and I need to call the function on the HTML side to achieve this. How can I do that? Thanks for your time. ~ SJ
  6. Here's the code I am trying to work on: Private Function CustomizeDataSet(ByRef ds As DataSet) As DataSet Dim rowCount As Integer, newDs As New DataSet Dim dt As New DataTable newDs.Tables.Add(dt) For rowCount = 0 To ds.Tables(0).Rows.Count - 1 Dim newDr As DataRow If Not rowCount = 0 Then Dim colCount As Integer For colCount = 0 To ds.Tables(0).Columns.Count - 1 newDr = dt.NewRow If Not ds.Tables(0).Columns(colCount).ColumnName = "Title" Then newDr.Item(colCount - 1) = ds.Tables("Jobs").Rows(rowCount).Item(colCount) Else Dim hypDesc As New HyperLink hypDesc.Text = ds.Tables("Jobs").Rows(rowCount).Item(colCount) hypDesc.NavigateUrl = "JobInfo.aspx?id=" & ds.Tables("Jobs").Rows(rowCount).Item(0) newDr(colCount - 1) = hypDesc ------------> Error is here <---------------- End If dt.Rows.Add(newDr) Next End If Next Cache("Jobs") = newDs Return newDs End Function =========================================== What I am doing here is creating a new dataset 'newDs' from a dataset 'ds'. When I am running this code, it is giving me an error on the line shown above. It says that it cannot find the column 0.....Is there any other way to handle this. Thanks, SJ
  7. Hi..Does anyone know how to hide a datagrid column that is created at runtime but not hard-coded??? I saw some articles that are talking about changing the visible property of the column. I guess that works only when the column is created within the code but not obtained from a dataset as it is in my case.. SJ
  8. Hi....I am trying to access a windows form from a web form. I created an instance of the window form. But it giving me an error like this: -------------------------------------------------------------------------- It is invalid to show a modal dialog or form when the application is not running in UserInteractive mode. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application. 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.InvalidOperationException: It is invalid to show a modal dialog or form when the application is not running in UserInteractive mode. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application. Source Error: Line 35: dlg = New Morphic.ISS.Common.BrowseFolders Line 36: Line 37: If dlg.ShowDialog = Windows.Forms.DialogResult.OK Then Line 38: Dim info As DirectoryInfo = dlg.info() Line 39: txtFullpath.Text = dlg.FullPath -------------------------------------------------------------------------- This is how I defined the New() method for the windows form: -------------------------------------------------------------------------- Public Sub New() MyBase.New() 'This call is required by the Windows Form Designer. InitializeComponent() 'Add any initialization after the InitializeComponent() call FillTree() End Sub -------------------------------------------------------------------------- And this how I am calling the above New() method from a web form: -------------------------------------------------------------------------- Private Sub btnBrowse_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBrowse.Click Dim dlg As BrowseFolders dlg = New BrowseFolders If dlg.ShowDialog = Windows.Forms.DialogResult.OK Then Dim info As DirectoryInfo = dlg.info() txtFullpath.Text = dlg.FullPath End If -------------------------------------------------------------------------- Does anyone find anything wrong in the way I am calling the windows form from the web form??? - SJ.
  9. Hi Jade...What you said worked on my system without any problem. Now, I have a new problem. The same project is returning the same error for a different folder in a different system. Is this problem system specific??? I heard that if we use DirectoryInfo.GetDirectories() should not worry about this. I am using the same but I dont know why I am getting this error. The new error is showing that access is denied to C:\\Config.msi. Ideas? SJ
  10. Hey Jabe...That worked great....thanks a lot man..... SJ
  11. Hi Jabe, RIght now, this is how I am trying to check it, but it is returning true for every directory!! --------------------------------------------------------------------- Private Function IsSystemFile(ByRef dir As DirectoryInfo) As Boolean If dir.Attributes().System = FileAttributes.System Then Return True Else Return False End If End Function --------------------------------------------------------------------- Please let me know if there is any other way to check that. And 'mutant'.....I am using the Directory.GetDirectories class to get the list of directories. This is what it is saying when I run the application: -------------------------------------------------------------------------- Access to path f:\\System Volume Information is denied -------------------------------------------------------------------------- I am not getting this message for the C and D drives which are being checked before the F-drive according to my algorithm. Any ideas?? Hi 'PlausiblyDamp'...I understand that it is the permission problem. But when we r running this application on the web, we cant possibly do anything about the permissions of the user's system directories..istn't it??? Thanks for your time guys...... SJ
  12. Hi...The title pretty much says what I am trying to do. This is because when I am populating a treeview with all the folders from the system, it is saying that the directory F:\System Volume Information cannot be accessed because it is a system file. It doestn't exactly say the reason but thats what I am thinking. The wierd thing is C# is not having this problem. It is with VB.NET alone. Any ideas? SJ
  13. Hi...I am trying to sue this class in my application. But I cant find the FolderNameEditor in the Syste.Web.Forms.Design namespace. You were saying that we can write a public class if we want to use the Protected FolderNameEditor.FolderBrowser class. How can we do that? Thanks, SJ
  14. hi...its not working like that too!!! Probably I wastn't clear of what i am trying to do. I have a user control (.ascx) file that looks something like this. ========================================== <%@ Control Language="vb" AutoEventWireup="false" Codebehind="Footer.ascx.vb" Inherits="MSI.Web.Footer" TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %> <TABLE id="Table1" cellSpacing="1" cellPadding="1" width="800" border="0"> <TR> <TD vAlign="top" align="left" rowSpan="1" colSpan="3"> <HR align="left" width="100%" SIZE="0"> </TD> </TR> <TR> <TD style="WIDTH: 305px"> <DIV style="DISPLAY: inline; FONT-SIZE: 14px; BACKGROUND-IMAGE: none; VERTICAL-ALIGN: super; WIDTH: 296px; COLOR: background; HEIGHT: 40px; BACKGROUND-COLOR: transparent" ms_positioning="FlowLayout"> Some text. </DIV> </TD> <TD style="WIDTH: 285px" vAlign="top" align="center" onmouseover=getthedate()> <div align="center"> <span id="clock">Time</span> </div> </TD> </TR> </TABLE> ======================================= I want the time to display at the text "Time" in the above code, not at the onmouseover event or anything like that but when the page is loaded. I have the text "Time" within the <span> tag because the .js file above requires it. Do u think what I am doing is right?? Please let me know. Thanks, SJ
  15. Hi...I am trying to use a javascript file that shows the current date and time. The thing is I dont have any idea on how to use it in ASP.NET. RIght now, the code is like this but it doesn't seem to work. Any suggestions? This is where I want the time to display: ===================================== <TD style="WIDTH: 285px" vAlign="top" align="center"> <div align="center"> <script language="JavaScript" src="LiveDateAndTime.js" type="text/javascript"></script> <span id="clock"></span> </div> </TD> ===================================== and this is my "LiveDateAndTime.js" file : ===================================== var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday") var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December") function getthedate(){ var mydate=new Date() var year=mydate.getYear() if (year < 1000) year+=1900 var day=mydate.getDay() var month=mydate.getMonth() var daym=mydate.getDate() if (daym<10) daym="0"+daym var hours=mydate.getHours() var minutes=mydate.getMinutes() var seconds=mydate.getSeconds() var dn="AM" if (hours>=12) dn="PM" if (hours>12){ hours=hours-12 } if (hours==0) hours=12 if (minutes<=9) minutes="0"+minutes if (seconds<=9) seconds="0"+seconds //change font size here var cdate="<u><font color='#004e98' face='Garamond'><b>"+dayarray[day]+", "+montharray[month]+" "+daym+", "+year+" "+hours+":"+minutes+":"+seconds+" "+dn +"</b></font></u>" if (document.all) document.all.clock.innerHTML=cdate else if (document.getElementById) document.getElementById("clock").innerHTML=cdate else document.write(cdate) } if (!document.all&&!document.getElementById) getthedate() function goforit(){ if (document.all||document.getElementById) setInterval("getthedate()",1000) } ===================================== I know the javascript file has no errors as I got it from the web and it is working on a normal HTML page. Do I have to do anything special in .NET environment???? ===================================== Thanks, SJ
  16. Hi....Can anyone tell me how to load a usercontrol before the actual page that contains the user control is loaded?? I have a usercontrol defines like this in the .aspx.vb page: Protected WithEvents StateControl As ddlState ======================== and I have the page load function in the main page like this: ======================== Protected Overloads Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load MyBase.Page_Load() If Not Page.IsPostBack Then Dim curUser As User curUser = New User(Session("username")) ' Retrieves all the information into the "curUser" instance of the "User" class curUser.Retrieve() StateControl._State() = curUser._State() ........................ ........................ End If End Sub ======================== The error: ======================== 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. Source Error: Line 67: ' Retrieves all the information into the "curUser" instance of the "User" class Line 68: curUser.Retrieve() Line 69: StateControl._State() = curUser._State() Line 70: lblUsername.Text = Session("username") Line 71: Load_Label(curUser._Pass()) Source File: W:\Morphic\MSI.Sol\MSI.Web\MSIEditProfile.aspx.vb Line: 69 ======================== I have tried many things but everything turned out be futile. I know what the problem is but I am not able to figure out how to fix that. The Problem: The Page_Load() method of the .aspx page is loading before the Page_Load() of the user control. So, the "StateControl" is 'nothing' in Line 69 above. I even placed the whole code in the Page_Load() method of the user control in the Page_Init() method. It didn't work wither. Any help would be really appreciated. Thanks, SJ
  17. Hi....Can anyone tell me which namespace we have to import to use the Excel.Application....My code is saying that Excel.Application is not defined.... Thanks, SJ
  18. Hi....I wrote a function to create a .CSV file from a SqlDataReader. Now, in some places, I need the same function to work on a DataRow. How can I convert the data in the DataRow into a SqlDataReader??? Similarly, I want to perform the same function on a DataSet..... How is it possible? Thanks, SJ
  19. I was able to fix that issue myself.... Actually, the problem was something else...I mean the error is still in that line....The fact is when a .aspx page has a user control in it, the main page loads first and then the user control is loaded...So, if we are trying to access the usercontrol within the Page_Load() of the main page...you are bound to get the NullPointerException...You cannot escape that...... I think the best way to handle this is to write the code (no matter what we are trying to do) in the Page_Init() method rather than the Page_Load() method of the user control....Thats how I was able to solve my problem..... For example...I am trying to load the dropdownlist in the user control when the user control is loaded...in other words, when the user control is initiated...... Hope this helps.... Thanks anyway. SJ
  20. Yes....it works when I dont call the WriteCSV function .. SJ
  21. One more question related to this Does a user control on an .aspx page load when the main page is loaded? SJ
  22. Hi.....This part of the code does not work for some reason...It is always giving me the same error that: Object reference not set to an instance of an object this is the whole code for the user control which loads the drop down list for states... ========================================== Public MustInherit Class ddlState Inherits System.Web.UI.UserControl Protected WithEvents SqlConnection1 As System.Data.SqlClient.SqlConnection Protected WithEvents SQLCommand1 As System.Data.SqlClient.SqlCommand Protected WithEvents ddlStates As System.Web.UI.WebControls.DropDownList Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim connect As SetUpDBConnect, dset As New DataSet connect = New SetUpDBConnect("webGetState") dset = connect.Get_State() connect.Close() Dim count As Integer, noOfRows As Integer noOfRows = dset.Tables(0).Rows.Count For count = 0 To noOfRows - 1 ddlStates.Items.Add(dset.Tables(0).Rows(count).Item(1)) Next count End Sub Function GetState() As String Return ddlStates.SelectedItem.Value End Function Function SetListValue(ByVal curState As String) ddlStates.Items.FindByText(curState).Selected = True End Function End Class ======================================= It is giving me error on the 3 rd line from the bottom....I dont have a clue why it is doing so.....I really need some thought from someone else...I am out of ideas....Thanks.. SJ
  23. Hi...can anyone tell me what is wrong with this function to write data to a file from a datareader?? Function WriteCSV(ByRef reader As SqlDataReader) Dim strFile As String strFile = "D:\CSVData.csv" Dim writer As New StreamWriter(strFile, True) While reader.Read writer.WriteLine(reader(0)) writer.WriteLine(reader(0)) End While 'fs.Close() End Function I am calling this function from here: Dim command As SqlCommand = New SqlCommand("Select * FROM Products", DBConnection) Dim reader As SqlDataReader = command.ExecuteReader(CommandBehavior.CloseConnection) WriteCSV(reader) dgrOut.DataSource = reader dgrOut.DataBind() For some reason, the datagrid operations after the WriteCSV()function is called are not executing... Thanks, SJ [edit]Please use tags [/ vb][/color] [/edit]
  24. Hi..I am having a problem while trying to add a new project to the exixsting solution in the .NET environment. I set up the IIS's home directory as the folder of the solution too. the error it is throwing is something like this: ---------------------------------------------------------------------------------- The web server reported the following error when attempting to create or open the web project located at the following URL : 'http://localhost:400/MSI.Web'. 'HTTP/1.1 500 Internal Server Error'. ---------------------------------------------------------------------------------- The MSI.Web folder is already present in the solutions folder. Can anyone help me with this one.??? Thanks, SJ
  25. Hi, How can we clear the session? I tried to use Session.Clear(), Session.RemoveAll() and Session.Remove("variable") but nothing seems to work. After I logout, I am still able to come back to the previos page!!! this is the code from the logout.aspx.vb : =========================== Session.Remove("username") Session.RemoveAll() Session.Clear() =========================== and this is the secured page that checks if a user is logged in : =============================== If Session("username") = Nothing Then Response.Redirect("Login.aspx") End If =============================== Whats wrong with this code? SJ
×
×
  • Create New...