Finding runtime errors in a singleton class

Hi, How to find the memory leaks in a singleton class? How to instantiate the object of a singleton class? Actually how to run the singleton type classes manually in a website?.
discussion1:Its hard to say based on what information you provided.I usually create singletons like this: http://wiki.asp.net/page.aspx/288/singleton/Other patterns such as the synclock double check pattern are not as reliable as they might appear..

ASP.NET user in MS SQL Server

Hi,I want to showcase ASP.NET to my boss. I have deduced from error messages and Internet research that the problem is -> MS SQL Server 2005 (Express ed) requires an ASP.NET user. Note, I can manipulate the db without a problem through normal ADO.NET using any non ASP.NET app. But as soon as the project is an ASP project, I cannot interact with the db. Who can solve this riddle? .
discussion1:We will need a little more to go on.Do you have a ConnectionString in your Web.Config?What version of .NET are you using? (3.5 and LINQ make it rediculously easy)Do you have a code sample of what is NOT working?Do you have an error code and/or a stack trace?.
discussion2: To test, you need From Server Explorer in VS make a connection to your Datbase, then if successful then Drag a table into your form.check this works or not .
discussion3:We are using visual studio 2005 and SQL Server 2005 (expressedition). Unfortunately, I cant give code snippets until Monday morning when Ihave access to his laptop again. I was hoping this was a common thing that justcould be answered generically. In my research, I have found many people askingthis question. I have never found anyone able to answer it. .
discussion4: Hi,if in your db connection string is like this:.... Integrated Security=True.... You need to add user ASPNET to your database Or you can replace your Integrated Security to.......................... User ID=(an sql server account); PWD=...... .
discussion5: Thanks Thoeun, Integrated Security=True was in the connection string. How do I add user ASPNET to the database ?.
discussion6:when an asp.net web page runs, it runs under a special account. if your page is running under xp, then that account is the local ASPNET account on the box serving up the pages. If your page is running under Windows Server, then that account is the local NetworkService account on the box serving up the pages.If SQL is running on the same box that is serving the asp.net pages, then you can add those accounts into sqls accounts and give them permission. If sql is running on a different box though (which is usually the case) then that other sql server box will not recognize the local accounts from the asp.net server. In this configuration, you could use mixed mode security for your SQL server instance and create a SQL account directly in SQL server itself. Then from your ASP.NET box, you would specify those credentials in the connection string.various types of connection strings can be found here: http://www.connectionstrings.com/ .

retreiving variables in .ascx page , from .aspx page

Hi,Ive googled this problem, and found a few threads, but its not fixing my issue. I have a user control (myheader.ascx) in which I programatically set 2 variables. I am trying to get the value of these variables in an aspx page, but the values are always nothing. I can reference the values in the aspx.vb code behind.Heres what Im doing, does anyone have any suggestions ?? Thanks very much!!mike123 Private _isFrom_Search As BooleanPrivate _SearchGender_forBind As StringPublic Property isFrom_Search() As BooleanSet(ByVal Value As Boolean)If Not String.IsNullOrEmpty(Value) Then_isFrom_Search = ValueEnd IfEnd SetGetReturn _isFrom_SearchEnd GetEnd PropertyPublic Property SearchGender_forBind() As StringSet(ByVal Value As String)If Not String.IsNullOrEmpty(Value) Then_SearchGender_forBind = ValueEnd IfEnd SetGetReturn _SearchGender_forBindEnd GetEnd Property and in the aspx.vb page I have these 2 lines : (these are excerpts obviously =])If myHeader.isFrom_Search = True ThenSelect Case myHeader.SearchGender_forBind.
discussion1:Maybe you reference them in your page in the event handler, that executes before the controls event handler, that initializes those variables? Try to play with the breakpoints..
discussion2:mike123:.
discussion3:Hey Guys,I am setting the values in my myHeader.ascx page on this subPrivate Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load I am attempting to retrieve them on the aspx.vb page, on this sub:Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Regarding the steps:1.) ok2.) ok if the user control is created with no default values3.) ok I am setting a property either false or true, and I am always retreiving NULL in the aspx.vb page4/5.) what do you mean by potentially initializing? Any further help is greatly appreciated !! .. still pretty suck on this .. thanks agian,mike123.
discussion4:You need to set a breakpoint in your page_load of the aspx and watch the order everything happens.I have a feeling that your problem is the page life cycle of the page and the user control..
discussion5:hi scriptstudios, good point... after stepping thru my code, I have realized that the Page_load of the aspx file actually fires before the Page_Load of the ascx file.Does this mean what I am trying to do is not possible ? At this point it sure seems like it.since the value passed is determined programmatically, passing a default value is not an option.youve been a great helpthanks again!mike123.
discussion6:I think you need to add a string property rather then Bool to check that it works,Remember a point, If you use simple property types such as int, DateTime, float, and so on, you can still set them with stringvalues when declaring the control on the host page. ASP.NET will automatically convert the string to the propertytype defined in the class..
discussion7:Hi,Isnt passing datatypes and relying on implicit conversion bad practice ? I tried doing this but no luck ...... Can anyone chime in here and comfirm its definately possible ? This issues killing me thanks again,mike123.

unable to delete image

hi!i am trying to delete image on folder on server.this code is working when i am deleting the image which is copied from my local sys to server. but the same code is not working when i try to delete to the image which is uploaded through the fileupload control. dont ustnad the condept. i just changed the imganame but image not delted.whats realy wrong. pls suggest.Tryimgname = "sample.jpg"File.Delete((Server.MapPath(imgname)))Catch ex As FileNotFoundException lblStatus.Text += ex.MessageCatch ex As Exception lblStatus.Text += ex.MessageEnd Try.
discussion1: Tryimgname = "~/foldername/sample.jpg"File.Delete((Server.MapPath(imgname)))Catch ex As FileNotFoundException lblStatus.Text += ex.MessageCatch ex As Exception lblStatus.Text += ex.MessageEnd Try.
discussion2:no luck friend.pls suggest anyother way. i want to delete old images. .
discussion3: What error are you getting?.
discussion4: Hi,AbithaPlease Cler Up ur Problem.Thanks. .

How to get started with ASP.Net

Dear Friends,I am a C#.Net and VB.Net Developer. But I Dont know even HTML in Web developement field. I am planning to get started with ASP.Net. Pls guide me How to begin with? Which is the best book to get started.Thanks in Advance..
discussion1:Hello,You could start from here - http://www.asp.net/learn/Here you could find some good ASP.NET books and reviews - ASP.NET BooksRegards.
discussion2:Hi,emcubeWelCome To the forumns.asp.netFor Basic u can Refer Following Urls Here U will also get Html Knowledgehttp://www.w3schools.com/For Basic of Asp.net U can refer http://www.asp.net/get-started/U can Also Refer http://www.asp.net/learn/ There are numerous of Videos along with source codes which will help u.and for ur queries U can post ur queries here on the Asp.net Forumns. As far as Books in each section of the forumns on the right side there is window where list of good books are shown U can Refer That .example on the page http://forums.asp.net/15.aspx at the right side there will be section Recommended Books .U can Refer That PLZ MARK AS ANSWER IF IT HELP U.THANKS. .

two progress control work with eachother

I used progress control in my website.one of it is n masterpage and another in in a content.when i press the button that is in content page ,both pic that is in progress control in master page andthe pic in content work.i want to when i press the button in content only only progress control of content work.is it passiple?how?.
discussion1: Are you sure you have 2 different updatePanels for each UpdateProgress control ?Can you show the masterpage and content page code? .

Upload files using an IFRAME and save the name of the file to a database

Hello guys,I have a form that saves some data to a table. One of that field is a filename. I am using an iframe with a fileupload control to put the file on the server but I dont know how to pass the name of the file to the container form to save it to my database. Any ideas?Thanks a lot.David.
discussion1:If the IFrame is in the form itself then why cant you directly use the file upload control in the form ??If you want to learn file uploading you can check it here http://quickstarts.asp.net/QuickStartv20/aspnet/doc/ctrlref/standard/fileupload.aspx.

File reader

I am using windows application i need to Read XML files from my Computer and get tht subnodes values how to i Get ?.
discussion1:Use the XML class of asp.net class libraryYou will find several tutorials like that over the net....i am just listing a few herehttp://msdn.microsoft.com/en-us/library/system.xml.aspxhttp://www.codeproject.com/KB/XML/csreadxml1.aspxhttp://www.dotnetspider.com/resources/21052-Reading-XML-File.aspx .

Buttons with small heights do not display text centered vertically

The appearance is almost correct in design view of Visual Web Developer 2008; its slightly worse in Internet Explorer and Chrome, and worst in Firefox. Again, thank you for help in advance. .
discussion3: try this css:input {height:16px; padding-top:0px; font-size:9px;}.
discussion4: Thanks again Lolli. Changing the font size to be even smaller does make the text legible within the button, but it sidesteps the issue that Im trying to resolve - eliminating the apparent padding at the top of the button. Id like to have a small button with a font that fills most of the height of the button but remains vertically centered, instead of using a tiny font that is pushed to the bottom of the button. But that apparent padding at the top sits in the way. .
discussion5: Hi, Please use this CSS.
Do you see what I mean? .
discussion7:Oops - had an extra style tag in there. When removed, both CSS classes give the same result in firefox - 16 pixels high but still the padding on the top... Untitled Page

popup modal throws exception displaying file

Hi, I have a popup modal where the user can select a document (word, pdf, excel) to display. Once they select the document the code displays it in the browser using the code as follows: Response.Clear() Response.ClearHeaders() Response.ClearContent() Response.ContentType = GetContentType(Filename) Response.AddHeader("Content-Disposition", "attachment; filename=" & Filename & "; size=" & Buffer.Length.ToString()) Response.Flush() Response.BinaryWrite(Buffer) Response.Flush() Response.End()The document displays correctly, but the code throws an exception at Response.End(). Does anyone know why this occurs, or have a better way to accomplish this task? .
discussion1: Hi jerrykur,try this. System.IO.FileInfo pdfFile = new System.IO.FileInfo(path); if (pdfFile.Exists){Response.Clear(); Response.AddHeader("Content-Disposition", "attachment; filename=" + file);Response.AddHeader("Content-Length", pdfFile.Length.ToString()); Response.WriteFile(pdfFile.FullName);Response.End(); } .

PasswordRecovery Control

Hi all,I am using the PasswordRecovery Control in one of my websites to enable a user to recover forgotten passwords.The issue that I have is that I want to style it to the look and feel of my website. As such I converted it to a Template. Since doing this I have discovered that the control no longer works the way it should.Normally the user types in their username and clicks the button to go to the next step, where they are presented with a Question. The user then answers the question and is sent an email.Since templating this control I no longer get the Question displayed in the second step.Does anyone know if this is an issue, and if their is a work around. Kind RegardsScottyB .
discussion1:For those interested, I managed to solve this issue.The problem was a result of known bugs within the CSSAdapters relating to the login controls.There were two workarounds for this that will fix the problem.First Method Remove the relevant lines from the CSSFriendlyAdapters.browser file in the App_Browsers folder that relate to the PasswordRecovery Control Second Method If you still want to use the PasswordRecovery Control with the CSSAdapters, add the following code to the Verifying User Event Protected Sub PasswordRecovery1_VerifyingUser(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.LoginCancelEventArgs) Handles PasswordRecovery1.VerifyingUser Uncomment this if you are using the cssadpters with the PasswordRecovery Control. When the CSSAdapters are used the Username and Question Field are blank in the QuestionTemplate They should not be as how does the user know what question to answer if they dont have the Question The code below fixes this situation when for the Password Recovery Control Dim txtUserName As TextBox = CType(PasswordRecovery1.UserNameTemplateContainer.FindControl("Username"), TextBox) Dim ltlUserName As Literal = CType(PasswordRecovery1.QuestionTemplateContainer.FindControl("UserName"), Literal) Dim ltlQuestion As Literal = CType(PasswordRecovery1.QuestionTemplateContainer.FindControl("Question"), Literal) Dim user As MembershipUser = Membership.GetUser(txtUserName.Text.ToString) ltlUserName.Text = user.UserName ltlQuestion.Text = user.PasswordQuestionEnd Sub It took me 2 days and a lot of frustration to track down the cause and fix for this issue. I hope someone else gains from this in their projectsKind RegardsScottyB .

This is Advanced - Idea Needed Please if you can

I have 2 table Question and QuestionTypeQuestion has Fields : QuestionID, QuestionText and QuestionTypeIDQuestionType: QuestionTypeID, IsYesOrNo, IsTrueOrFalse, IsRange, RangeMinValue, RangeMaxValue, IsText, MaxTextLengthNOTE: Here we are not following all the rules for designing the tables but i put it this way to give you a good idea of what i am trying to accomplish.Question: I need to display the questions one after the other on a web page. Say for example Question1 is YesOrNo the i need to display YES/NO a radio buttons for that question.If Question 2 is Range then i need to display DropdownBox with the specified range of numbers.If Question 3 is text then i need to Display Text box.Questions will be addred and removed from the database.Can you share your idea please..
discussion1:You can create controls in the code behind based on the values of the row.You could add a panel or placeholder control to group each question, and then add the right controls to that based on the database.http://msdn.microsoft.com/en-us/library/kyt0fzt1.aspx This explains the basic of how to create questions in code. You might want to research something called the Factory pattern. You could create a little function for building each type of question then perform a test on the row and call it to generate the controls you need. I can work with you a little more to flesh this idea out if you tell me what data layer you are planning on using (linq, strongly typed datasets, ado.net etc) and also what language you are working (c#/vb). .
discussion2:Hello GBS_ASPYou arent very clear on what you are requesting. So this response is in order to more clearly understand what it is you desire to accomplish.If you are desiging a table to be displayed on the page, are you binding it to a datasource? If this is coming from a datasource, is your question how you should set up the table in... SQL, Access...It seems you are explaining--> QuestionType -- Bit (0 or 1)QuestionText -- String (what value goes with the bit field ( 0 = False, 0 = No; 1 = True, 1 = Yes) )QuestionTypeID -- (??)Is your attempt to have a page with a table they can edit, delete, and add to- which in turn posts to a database? And is your question how to accomplish this in Asp.Net?Thank you for clarifying your post.Jeremy.
discussion3:Are you wanting these questions dynamically created, and randomly pulled from a database? Or are you going to have pre existing controls hard coded into the web page?.
discussion4: Hi -- first post here, hope it helps. Had a similar issue, and its solved with the RowDataBound event. You make a data control -- I used DataList but a Repeater would also work -- add your question toit, then some kind of block element to hold the response are -- div, table cell, PlaceHolder, or Panel.
<%# DataBinder.Eval(Container.DataItem, "question") %>
In your code behind, attach a databound event to the data list: DataList1.ItemDataBound += new DataListItemEventHandler(AddAnswerControls);Then, in that event, check what kind of question it is -- multiple choice, true/false, open ended (textarea), or whatever. (You did keep track of this soemwhere, right?). Based on that, add controls..

I need some help please!

Ok, so I am doing this project and I need to input the number 700 billion (700000000000) into the console. I forgot the code to let me input that large number into the console. That was number 1. No.2. So my program is required to ask for how much you would like to withdrawl (money), using the switch statment. I got everything to work but now the only thing that is urking me is when I put a "$" in front of what I want to withdrawl( ex. my balance is 1000, I want 100, my new balance should show as 900.) Well when I do the 100 WITHOUT the $ sign it comes out right. But when I try it with the $ sign it only subtracts 1.00 and shows as 999. If anyone can help me out with this it would be greatly appr. It is due tomorrow(Sat. October 24) Thanks again! .
discussion1: I am confused what you mean by input a number into the console. What console are you working with? It sounds like the $ is read by your console as currency and add a decimal and two places. What happens if you try and with draw $100.00 is it different from $100? Isnt today Friday the 24th .
discussion2:ha! Yes I am sorry! I mean Oct. 25. I am using 2005 visual basic. So when I try to input 700 billion it gives me junk ( -792572945) and obviously its not what I am looking for. I tried using the setw( ) as well as setprecision( ) and that doesnt seem to help. As far as the "$", if the console is taking the "$" sign as currency, is there a way we can avoid that. Maybe declare its value? When I try it as $100.00, I will still get a result of $999. .
discussion3:I would write some error handling to validate against the text box to make sure that only whole numbers are read, and that commas and dollar signs are ignored when processing the numbers.As far as storing a larger number, have you tried using Double?.

Locking table height

Ive created a table with 2 columns. In the table cell for each column Ive added a check box list. The lists can be long and I want to lock the height of the table and have scroll bars to see all the items. How can I do this because I cant seem to alter any table properties to result in what Im going for..
discussion1:hello friend, try putting your check box lists inside a div tag in the table cell:
that should produce a vertical scroll bar. adjust the height accordingly.hope this helps. .
discussion2:im1dermike:.
discussion3:Agreed, you are either using a div, or you are using JavaScript..

Gridview AccessibleHeaderText Question

Im having trouble making a gridview control section 508 compliant because not all of its Accessible Header Text is being recongnized by the screen reader. I set the controls UseAccessibleHeader property to true. And I set AccessibleHeaderText for all the field properties of the control. When the screen reader software reads the gridview, the only Table Headers it seems to recognize are for the boundfield properties. The other fields of the gridview are template fields and hyperlink fields. Its not reading the AccessibleHeaderText set for those fields for some reason.Does anyone know why this is or if there is a work around to make sure ALL the table header text is read for the gridview?.
discussion1:Can you give an example of your source code?.

string format double?

hey im trying to get ##.## all the time in my double percentage right? i have values like this 8888.354681and 25.35588 or58.2i tried this tcPercent.Text = String.Format("{0.0.##}", Percentage) + "%";no worky? they percentage value is a double any help? .
discussion1:Try using Float instead of Double.
discussion2:Try:String.Format("{0:00.00}%", Percentage);Thisll give:05.00% for 5Or:String.Format("{0:#0.00}%", Percentage);Thisll give you 5.00% for 5 .

basic "interaction-event" ?

Hi,Visual Studio 2008 Standard, C#, .NET 3.5:I have an ascx-control with a panel, which is only visible, after the user has saved the changes in a textbox.As soon as the user makes a different input than pressing a button on that panel, this panel must be invisible again.I placed Panel.Visible = false; in the pageload event. This works fine for the moment.But I am not shure if all inputs on the webpage will call the pageload-event.Is there an event, which is ALWAYS called when the user interacts with the website.Or is it ok, to use the pageload-event within the ascx-control (code-behind)?Please tell me, if you need more informations.Thanks for your input.Patrick .
discussion1:Im not really understanding the problem too well, can you elaborate more?.
discussion2:The Page Load event is not enough. However if the user were to do something else on the page that causes a postback, you can make a handler to set Panel.Visible=FalseFor example:say you have two textboxes... the user fills one and clicks off... you set the textbox to AutoPostBack = True and then on that autopostback you can set the panel.visible to truethen the user fills another textbox and the panel needs to be invisible, just have another "autopostback = true" and set the visibility to false.Also, if the page is not a postback, the Page_Load will do you just fineHope that makes sense..

Trouble populating dropdownlist in codebehind

Im not sure what Im doing wrong, but Im getting an error that says DataBinding: System.Data.DataRowView does not contain a property with the name Pittsburgh. System.Web Pittsburgh would be the selected row in the dropdownlist if it was populated. This is what I have: string strOfficeDDLSQL = string.Empty;strOfficeDDLSQL = @"SELECT OfficeID, OfficeName from Office Order By OfficeName";SqlCommand cmdSQLOffice2 = new SqlCommand(strOfficeDDLSQL);cmdSQLOffice2.Connection = DBConnectionClass.myConnection;cmdSQLOffice2.CommandType = CommandType.Text;cmdSQLOffice2.CommandText = strOfficeDDLSQL;// open database connectioncmdSQLOffice2.Connection.Open();// Use a DataAdapter to connect the SqlCommand to a DataSetSqlDataAdapter daOfficeDDL = new SqlDataAdapter(cmdSQLOffice2);DataSet dsOfficeDDL = new DataSet(); // Create a new instance of the DataSet classdaOfficeDDL.Fill(dsOfficeDDL); // use the DataAdapter to fill the DataSet//OfficeNameDDL.DataSource = dsOfficeDDL; // Set the DDL DataSource to the DataSet// OfficeNameDDL.DataBind(); // Bind DataSource to the DDL// Declare a DataRow class and fill it with data from DataSet//DataRow OfficeDDLRow = dsOfficeDDL.Tables[0].Rows;DropDownList OfficeNameDDL = (DropDownList)OfficesFormView.FindControl("OfficeNameDDL");OfficeNameDDL.DataSource = dsOfficeDDL.Tables[0] ;// loop through each row because there will be one row for Admin Partner// and one row for Director of Administration for each office.foreach (DataRow myRow in dsOffice.Tables[0].Rows){OfficeNameDDL.DataTextField = myRow["OfficeName"].ToString();OfficeNameDDL.DataValueField = myRow["OfficeID"].ToString();OfficeNameDDL.DataBind();// TextBox OfficeNameTextBox = (TextBox)OfficesFormView.FindControl("OfficeNameTextBox");//OfficeNameTextBox.Text = myRow["OfficeName"].ToString();TextBox OfficeNumberTextBox = (TextBox)OfficesFormView.FindControl("OfficeNumberTextBox");OfficeNumberTextBox.Text = myRow["HROfficeCode"].ToString();if (myRow["EmployeeRoletypeName"].ToString() == "Admin Partner"){string strAdminPartner = myRow["LastName"].ToString() + ", " + myRow["FirstName"].ToString() + " " + myRow["MiddleName"];TextBox OfficeAdminPartnerTextBox = (TextBox)OfficesFormView.FindControl("OfficeAdminPartnerTextBox");OfficeAdminPartnerTextBox.Text = strAdminPartner;}else if (myRow["EmployeeRoletypeName"].ToString() == "Director of Administration"){string strDirAdmin = myRow["LastName"].ToString() + ", " + myRow["FirstName"].ToString() + " " + myRow["MiddleName"];TextBox OfficeDirAdminTextBox = (TextBox)OfficesFormView.FindControl("OfficeDirAdminTextBox");OfficeDirAdminTextBox.Text = strDirAdmin;}}if (cmdSQLOffice2 != null){cmdSQLOffice2.Connection.Close();}}} .
discussion1:Youre databinding your dropdown list for each row in your table.What you need to do is add the item to the dropdown list for each row. No databind required.So, in your foreach, you will have OfficeNameDDL.Items.Add(new ListItem(myRow["OfficeName"].ToString(), myRow["OfficeID"].ToString()).
discussion2:ScriptStudios:.
discussion3:I realize this is already answered but ... doesnt that add a lot of extra processing?cant you just change OfficeNameDDL.DataTextField = myRow["OfficeName"].ToString(); OfficeNameDDL.DataValueField = myRow["OfficeID"].ToString(); OfficeNameDDL.DataBind();to OfficeNameDDL.DataTextField = "OfficeName"; OfficeNameDDL.DataValueField = "OfficeID"; OfficeNameDDL.DataBind();Just a thought... thats how I do it in LINQ anyways.Oh... that would however remove the entire foreach bit of the code... you would have to FindControl if you needed to add additional specs on the ddl after the fact..

Testing for NULL in VB

How do I test for a NULL value in the field of a row in a data table?My code is:1 Dim vField As String2 For Each Row As DataRow In SiteMapTable3 vField = Row("Url").ToString4 If vField ???5 vField = Mid(vField, 3, InStr(3, vField, "/") - 3) code continues6 End If7 NextWhat is line 3 if line 5 is not to give an error when vField = NULL?Thanking you in anticipation.Roger.
discussion1:If Not IsNull(vField)Jeff.
discussion2:Hi,Here is your solution,Dim vField As StringFor Each Row As System.Data.DataRow In SiteMapTable If Not Row.IsNull("Url") Then checking if coloumn Url is null or not vField = Row("Url").ToString if not null then storing value in variable If vField.Length > 3 Then check if the length is greater than 3, this will prevent indexoutofrange error vField = Mid((vField), 3, InStr(3, vField, "/") - 3) End If End IfNext thats it, if this solves your problem PLEASE MARK IT AS ANSWER.thanks .
discussion3:you might want to check for "nothing" too.
discussion4:AbhishekThanks for this. Would you recommend including the vField.Length > 3 even if the code updating the database table could not enter a url that was < 3 without a "/" in it?Roger.

precompilation no performance gains

http://msdn.microsoft.com/en-us/library/ms227976(VS.85).aspx Im a bit frustrated.Thats what I did:- Published my project to a temporary directory- I then successfully ran "aspnet_compiler -p -v / "- Next, I restarted IIS...and the initial page request still takes about 90 seconds to load. Once the site is loaded and I hit F5 it reloads within seconds. Either I completely misunderstood the concept of precompilation or its not working properly.Any suggestions?.
discussion1:Try to determine whether the 90 seconds are actually taken up by compilation. You could try using ETW traces, or use procmon to see if csc.exe/vbc.exe is launched.It could just be the start up time for the first request, including creating the appdomain and other initialization logic?What if you now restart IIS and request again (without clearing the temp folder)?.

Best practice for storing 'user modes'

Dear Everyone! First of all, sorry for my poor english :-) Im thinking about a solution for my web application, because I cant decide how to store program specific datas.I have a page whats doin a db query and get a few strings. These decide if a user have new private message and other things (such as read, write or full accesses to other parts in the page). So these datas are program specific datas, they control the logic of the code. So it is important to store them safely.I just dont want to get these datas in every Postback (cuz the db queries are quiet slow in that way) , only in the first, then store them until I dont delete em by code (that means doesnt matter if a user sign in or sign out... hell need that datas until the code doesnt reach that point to delete the em) So these datas are strongly user specific too. I am not a professional programmer only an experienced one, but I dont needed to store datas like these before... So please gimme some advices about that problem.I read that article too: http://msdn.microsoft.com/en-us/library/75x4ha6s.aspx , but still cant decide wich solution better. (Wich fit most of my requirements).
discussion1:I read many articles/topics about this problem since yesterday and figured out the pros and cons of sessions, and/or cookies, and profile. Sessions: 1 session per browser, so I have to user User.Identity.Name in session objects to avoid that a user can look another session objects within one browser. I can use InProc mode, but when the admins restarting IIS the whole thing messed up. Okay, then I can use SQL Server... the main purpose that avoid many SQL server queries... And finally: if sessions do not using cookies, when a user copy the url to another... the whole thing messed up again (so I cant avoid using cookies, so why dont use only that?)!I think sessions have more cons than pros. Profile: using SQL....So in this case, I think Cookies are the best. They stored at user, so IIS reset wont be a problem. The app doesnt have to do same db queries over and over again. The only thing I have to care about that the cookies are enabled at the company or not.Only two problems left:One - cookies are user specific, or I have to write User.Identity.Name in the cookie name??Two - To read a cookie from hard disk much slower then get data from servers memory, not? Please help! :-) .

menuitemclick problem

hi,can someone please explain me why it takes two click on menuItem to navigate ?please help me with this...i dont understand whats going wrong with this...thanks a ton in advance...I have a userControl (myUC.ascx) consisting menucontrol which is in userControlLibrary.I have not set up the navigation link to any of the menuItems.I am raising the onMenuItemClick ,like following inside the user control (myUC.ascx)and passing it down to the code which is using this userControl.My code (myPage.aspx)is in diffrent project and i am referencing the usercontrolLibrary dll in this projectmyUC.ascx.cspublic event MenuEventHandler menuItemClick;protected void menuClick_setNavigation(object sender, MenuEventArgs e) { if (menuItemClick != null) { menuItemClick(this, e);}} myPage.aspx.cs protected override void OnInit(EventArgs e) { base.OnInit(e); myUCID.menuItemClick += new MenuEventHandler(myUC_menuItemClick); } protected void myUC_menuItemClick(object sender, MenuEventArgs e) { switch (e.Item.Value) { case "item1": e.Item.NavigateUrl = "page1.aspx?id=" + Id;//Problem is it takes 2 clicks to go to the page1.aspx. return; } }.
discussion1:I didnt read your problem to the detail, sorry for that but im in a hurry. My experience with double clicks is that when user clicks once, then you cant catch the state in your code and it wont happen. The next time you click, the state from previous is caught in your code and it fires. Its typical when you have some check in your init event, when some controls havent loaded all the state data. Try to move that code into pageload. Although some controls even dont reflect change all that well so i always perform my logic checks in PreRender event if its possible. :)Try placing all you logic and checks into Prerender of your control :) .
discussion2:thanks Daleo for your response..i am just trying to capture the menuItemClick in the page which is using menu user control.So i have it placed under onInit {base.OnInit(e);myUserControl.menuItemClick += new MenuEventHandler(uc_menuItemClick);} My checks and logic are under menuItemClick,where i check which menuItem is clicked to set the navigation url..i am lost as i dont know where does preRender event fits in this scenario?I am really looking forward for some solution....
discussion3:i removed the navigateURL instead used response.redirect.it worked...
discussion4:Hello There,Just wondering how about setting the NavigateUrl before pressing the menu item link.Thanks.
discussion5:thanks but how wud u do that?my menu is in user control which is in separate library(project) and i can not set the navigateUrl there statically.So only way i can think of doing is,by finding out what menuItem is clicked and then set it to the url.Please let me know if u know how to do it in my scenario..
discussion6:Hello There,can you please post some markup part code from user controlThanks.

Update Master Page control without full postback

I have one master page and a content page inside an update panel. I want to update label control on master page when there is some thing happening on content page without full postback.Regards,Imran Ahmad Mughal .
discussion1:I think you should use some sort of AJAX control on your masterpage for that..
discussion2:Update panel is AJAX isnt it? you should probably ask this question in the AJAX forum .

Add/Remove Checbox at runtime

Hi, i am having a lil question for you guyz to answer. the Scenario is something below:My employer wants me to create a page in admin panel that can change the contents of the Search Page provided for the users. means to say, admin can define the search criteria. the page contains mostly the check boxes. how can i add / remove checkboxes on the search page and how can admin alter the settings. this search page has the SQL query at the backend to search from the database. i also have to include these check boxes in the sql query if checked. What approach / method can implement this. Setting Control.Visible = true/false may change the looks and concurrency of the page.Can any body suggest me the solutions? Thanks, Let me know if i am not clear with my explanation.. .
discussion1:Hello! If I understood you correctly you want to show/hide checkboxes. As I see it you could do it in 2 different ways. Either by generating you controls dynamically, which is really nice once you get it to work since only the controls that are allowed by the admin would be generated.OR just do what you said and that was to just set them to .visible=false.If you can get the search page to look ok by just setting the controls to not visible that is a lot easier.check out: http://aspnet.4guysfromrolla.com/articles/092904-1.aspx and http://support.microsoft.com/kb/317515 Cheers!/Eskil .
discussion2:doubleposted by accident....

how to protect email from spiders?

1.
discussion1:Hi!They use images instead of e-mails for the reason you said, spiders. Unfortunately these irritating spiders are getting more intelligent and I recently generated some images according to user e-mail, which to start with is a half witted solution.You cant use mailto: since that will be picked-up by spiders, you cant write anyones e-mail in text and spam is up since using the image generated e-mails....So from here on Ill stick to form based contacts and thats it.The reason some spiders cant "save" the image is because theyre looking for text, usually with a @ in it. The newer spamspiders seems to spider images as well so stick to form based contact solutions where the client dont have a clue what the e-mail is sent to. Cheers!/Eskil.
discussion2:2.
discussion3:Hi again,I can save the image containing the e-mail to my hard-drive, how do you mean the image cant be saved?Cheers!/Eskil.
discussion4:3.
discussion5:I can save the image that says scorpionunix(eMailCharacter)gmail.com. Sometimes pages have javascripts that doesnt allow right clicking in a page, but they really cant stop you from saving images if they let you see them...Cheers!/Eskil.
discussion6:tnx very much u right.

several ModalPopup extenders on the same page

How to get clientId of web control under grid view in editItemTemplate

Question:Hello all,I am using Master page concept and this is content page.I want to get How to get clientId of web control under grid view in editItemTemplate.This is my code:Code:. --discussion1:Hello all,No one is here to understand my problem and give some fruitful solution..

Use of AJAX ValidatorCalloutExtender

Question:I have a requiredfield validator added and then add on ValidatorCalloutExtender.It works fine but I found when leave it blank, both the callout (AJAX) and the original validator error red text appear.How to get rid of the latter and/or make it invisble but keeping the text of the callout ? ThanksRight now I keep the ErrorMessage="XXX" in the RequiredFieldValidator tag.I found if I removed it then the callout text shows "This Control is invalid". Please help. Thanks . --discussion1:Here is my code.Pls help... . --discussion2:Pls help...plsease.

Redirect a page on button click event

Question:Hi, Gud day to you all...i am having a doubt whether i can send the property values while redirecting the page on button click event.when i click a button i want to redirect the page default.aspx..and i need the array variables for the property of the target page that is default.aspx page..how can i send the array variables from the source page...the below code is the property of the target page (default.aspx)... Public WriteOnly Property SectionColln() As Guid()Set(ByVal Value As Guid()) section_colln = ValueEnd SetEnd PropertyPlease kindly help me....... thanks in advance for helping me... . --discussion1:In Page 1, declare a public variable and assign some values to it and when click button, redirect with Server.Transfer method.In Page 2, in html design view, add PreviousPageType directive tag, <%@ PreviousPageType VirtualPath="~/Page1.aspx" %>In Page 2, code-behind, string strSectionColln = PreviousPage.SectionColln;Response.Write(strSectionColln);For more info about page directive, go to http://www.aspdotnetcodes.com/Asp.Net_Page_Directives.aspx .

Security Hole in my website ovbet.com

Question:Dear All, I wrote a complete website in ASp .NET vb. I used WindowsForms authentication and I also used windows standard login and registration components. I whought that it is secure but unfortunately, they found my password and called me and said my password to me. How it is possible? and then they adviced me to use Captcha in login and registration, but it is not possible in standard windows login and registration component. How can I solve this issue? . --discussion1:Dont worry,These are the possible chances to hack a website1. SQL Injection2. Session Hijacking3. Cross site scriptingSolution:1. If you are using direct query without use of SQL Stored procedure then its possible and also if you are using Dynamic SQL in your Stored procedure then they may hack your database. so avoid direct query(means dont write query within your Adapter and SQLComand use only Stored procedure2. This possible by some of the Tools but anybody cant easily hack this type, this is not possible in windows application3. This is possible by Javascript, this is not possible in windows applicationso, my best advice gothrough point 1.. --discussion2:Laborant:. --discussion3:I see that both of you has good answers I found them as an answer for me, but I do not know which to choose. Simply, SQL injection is not possible in my site, because the only site changes possible from the admin section and admin section security is doubled. There is only permission for one account and plus, there is also cookie checking. If you are not the right person then you will not be able to enter to the site. For deleting it is also same... .

setting text in password textbox of Login Control?

Question:I want to set text inside the textbox on the Login control,but i cant because the password textbox is readonly.i want to present the username and password everytime my user wants to sign in, so i save the username and password in a cookie.and extract it later in the page_load function.but i cant set the saved text that is in the cookie into the Login Control textbox.This is the code :in the LoggedIn event:MyCookie.Values["UserName"] = MyLogin.UserName;MyCookie.Values["Password"] = MyLogin.Password;in the Page_Load event :HttpCookie UserCookie = Request.Cookies["UserDetails"]; MainLogin.UserName = UserCookie["UserName"].ToString();MainLogin.Password = UserCookie["Password"].ToString(); // Compilation error!!!Error : Property or indexer System.Web.UI.WebControls.Login.Password cannot be assigned to -- it is read only.How do i set the password in the Login Textbox ? . --discussion1:use the remmeberme check box .

how to assign values to usercontrolwizard

Question:hai I want to assign value for username for usercontrolwizard (login).I dont want to there, I have to assign values Is it possible , how? Pls answer me. Thanks in advance . --discussion1:Are you talking about the or the control?CreateUserWizardYou can set it with CreateUserWizard1.UserName = "your value";LoginSet it in the Authenticate event: protected void Login1_Authenticate(object sender, AuthenticateEventArgs e){Login1.UserName = "your value";} . --discussion2:Hi ,Nit sure what you trying to do plz explain in more detailDo you want to displya default value.

Cookies Debugging Help

Question:Hi,We have a sign on page that typically works fine, but it looks like one user isnt receiving the authentication cookie. Ive been able to successfully send a test cookie to this user and read its contents later, but even trying to read the authentication cookie as var cookie = Request.Cookies[".ASPXAUTH"] fails. Has anyone else run into a problem like this? Where would you start debugging? Thanks. --discussion1:Hi stuart,We have a sign on page that typically works fine, but it looks like one user isnt receiving the authentication cookie. Ive been able to successfully send a test cookie to this user and read its contents later, but even trying to read the authentication cookie as var cookie = Request.Cookies[".ASPXAUTH"] fails. Has anyone else run into a problem like this? Where would you start debugging? Thanks.

FormsAuthentication.RedirectFromLoginPage

Question:Hi, i have a page with 3 iframes (Left, Center, Right).I have palced control in Center iframe to perform login: After login, application load in Center iframe instead to load in parent page (page that contain iframes). How can I obtain such behavior? Thanks . --discussion1:why dont you use master pages instead of using frames . --discussion2:because i convert my site from asp to asp .net....dont touch my iframes .

Application ID in Webconfig file?

Question:Does anyone know how to hardcode the application ID within the webconfig file? Thanks in advance!. --discussion1:Im not sure what you mean. You can do things with the Application Settings:Web.Config: protected void Button1_Click(object sender, EventArgs e){String AppID = ConfigurationManager.AppSettings["ApplicationID"];lblMessage.Text = AppID;} . --discussion2:if you mean the ASP.NET Membership ApplicationName , the Application Name is stored in machine.config in the following configration sections: You can override the machine.config configuration by copying the configuration to your website web.config file. Then to "Hardcode" the application Name copy the code xml below to your element in web.config then change the ApplicationName. I hope that help you.. --discussion3:Let me add to this. I have a application that I have users setup to use. Every time I move it to a different server none of the user credentials match up. I found that the application ID was changing with the directory change. Is there any way to hardcode this application ID that was generated when I setup the users utilizing Visual Web Developer? The idea is that the application ID will stay the same no matter where I move the application and my users will be able to get authenticated. Example:appID="c00ef106-c59b-42d6-a38d-da764627d366".

Define the ASP,NET work Process

Question:Hi Define the ASP,NET, work Process, I want to know about the asp.net work process.Help me.. --discussion1: http://www.west-wind.com/presentations/howaspnetworks/howaspnetworks.asp & http://www.dotnetspider.com/resources/1368-e-ing-at-happens-behind-e-sceans.aspx-->this will give u a brief explanation inetinfo.exe is the Microsoft IIS server running, handling ASP.NET requests among other things. When an ASP.NET request is received (usually a file with .aspx extension), the ISAPI filter aspnet_isapi.dll takes care of it by passing the request to the actual worker process aspnet_wp.exe When a request comes into Microsofts IIS Web server (inetinfo.exe, is ur webserver running) its extension is examined and, based on this extension, the request is either handled directly by IIS or routed to an ISAPI extension. An ISAPI extension is a compiled class that is installed on the Web server and whose responsibility it is to return the markup for the requested file type. By default, IIS handles the request, and simply returns the contents of the file requested. This makes sense for static files, like images, HTML pages, CSS files, external JavaScript files, and so on. For example, when a request is made for a .html file, IIS simply returns the contents of the requested HTML file. For files whose content is dynamically generated, the ISAPI extension configured for the file extension is responsible for generating the content for the requested file. For example, a Web site that serves up classic ASP pages has the .asp extension mapped to the asp.dll ISAPI extension. The asp.dll ISAPI extension executes the requested ASP page and returns its generated HTML markup. If your Web site serves up ASP.NET Web pages, IIS has mapped the .aspx to aspnet_isapi.dll, an ISAPI extension that starts off the process of generating the rendered HTML for the requested ASP.NET Web page. The aspnet_isapi.dll ISAPI extension is a piece of unmanaged code. That is, it is not code that runs in the .NET Framework. When IIS routes the request to the aspnet_isapi.dll ISAPI extension, the ISAPI extension routes the request onto the ASP.NET engine(aspnet_wp.exe), which is written in managed code - managed code is code that runs in the .NET Framework. to find more details on it google it with internals of asp.net key word. --discussion2:naveensheoran:.

Regarding ajax Calender Control

Question:Hi , Am using Ajax Calender control in my application. In IE6 am facing some problem with it. It is going behide select box and List box elements. Can any one have idea how to overcome from this issue. If know please do reply to this. . --discussion1:Hi,Please refer to this thread which has a similar request to yours: http://forums.asp.net/t/1308214.aspx Best regards,Zhi-Qiang Ni.

Tabcontainer activetabindex problem


Updated NUnit Project Template Forms

Question:Hello,Just downloaded MVC Beta 1 see that NUnit doesnt show up as an option for a testing framework. I found the NUnit templates from preview 3 (http://blogs.msdn.com/webdevtools/archive/2008/05/30/asp-net-mvc-preview-3-tooling-updates.aspx) and used these to build the default sample MVC app and the tests passed. Is a newer NUnit template release expected? Are there any gotchas or will I have unexpected grief somewhere down the road from using the older preview 3 forms with the new beta?Thanks. -Jim . --discussion1:I should also add that the preview 3 NUnit templates do not install on a 64-bit windows 2008 server machine that I use for development and testing. I opened up the .bat file and hard coded the path to the correct program files directory and also manually added the 64-bit reg keys (NUnitDemoPreview3_64bit.reg) in each of the C# and VB directories. Even with that, creating a new project in Visual Studio doesnt include any options for NUnit.Can anyone provide a timeframe when updated NUnit templates with 64-bit support will be provided?Thanks again,Jim .

AutoCompleteExtender with CascadingDropDownNameValue

Make:
Model:

overlapping calendars?

Question:did someone had a problem like this?Take a look how many elevens!!!Please help!!. --discussion1:Hi,Have you modified the original code of the AjaxControlToolkit CalendarExtender? Or Could you please post your related code here?What my suggestion is updating your AjaxControlToolkit to the latest version.Note:Version 3.0.202292008-02-29 release of the AJAX Control Toolkit targets the official release of .NET Framework 3.5 and Visual Studio 2008. Version 1.0.20229You can also download the Toolkit for .NET Framework 2.0, ASP.NET AJAX 1.0 and Visual Studio 2005. Version 3.0.208202008-08-20 release of the AJAX Control Toolkit targets the official release of .NET Framework 3.5 SP1 and Visual Studio 2008 SP1.Best regards,Zhi-Qiang Ni. --discussion2:I will download Version 1.0.20229 and post the results later.Thanks! .

RoundedCornersExtender causing text in GridView cells to disappear

>>>> /> Enabled="false" />>>

TextboxWatermarkExtender passes its value during Databind

Question: Hi everyone, I have a simple problem with the TextboxWatermarkExtender: I use it inside a DetailsView, which is itself inside an UpdatePanel like so: ... ... > > ... The issue is that if the Texbox is empty ( and the "Enter a number..." message is displayed ) and I click on Update, I get an error saying: "Conversion failed when converting nvarchar value Enter a number... to data type int", which is evidently an SQL Server error. Any help ? Note that I dont have this problem if I comment out the UpdatePanel and ContentTemplate... Thanks . --discussion1: Anyone?. --discussion2:Hi,From the code above, I understand that you use DataSource control to bind and update DetailsView control. The error message means that the DataSource controls update method cannot convert the "Enter a number...", which it retrieves from DetailsView, to int type which is expected.To resolve this issue, we can change "Enter a number..." to an int type in the DetailsViews ItemUpdating event.( Be similar to GridViews RowUpdating event.)For example, see http://www.asp.net/learn/data-access/tutorial-17-cs.aspx (Section:Improving the UnitPrice Formatting. ). I look forward to hearing from you. . --discussion3: You have 2 Solutions here :Handle the Updating event for the DetailsView DataSource , and change the RampUp parameter value to default integer value ( like 0 ) , Add Required field validator to ensure that the user enters value in RampUp TextBox : > .

Disable tooltip that appears when hovering on day in the ajax calendar

Question:Hi all.When I hover over an ajax calendar (extender) day, theres an annoying tooltip with the the date of the day that is hovered on.How can I disable it ?Thanks in advance.. --discussion1:Hi siorli Yes, we can remove the tooltip by modify the CalendarBehavior.js. In the source code of CalendarBehavior.js, you can search the "dayCell.title = currentDate.localeFormat("D");", near to the 986th line, and then, remove this line of code, the tooltip will disappear. Part of the code: for (var week = 0; week < 6; week ++) {var weekRow = this._daysBody.rows[week];for (var dayOfWeek = 0; dayOfWeek < 7; dayOfWeek++) {var dayCell = weekRow.cells[dayOfWeek].firstChild;if (dayCell.firstChild) {dayCell.removeChild(dayCell.firstChild);}dayCell.appendChild(document.createTextNode(currentDate.getDate()));//dayCell.title = currentDate.localeFormat("D");dayCell.date = currentDate;$common.removeCssClasses(dayCell.parentNode, [ "ajax__calendar_other", "ajax__calendar_active" ]);Sys.UI.DomElement.addCssClass(dayCell.parentNode, this._getCssClass(dayCell.date, d));currentDate = new Date(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate() + 1, this._hourOffsetForDst);}} Thanks. .

ModalPopupExtender & textboxes locking?

Question:Hey all, have an odd problem. Heres the specs first:VS2008, VB.NET, Ajax Toolkit (latest release). The issue is this: I have a modalpopupextender on an Asp:Panel, and when a button is clicked, the panel shows up. The panel has multiple controls on it, including textboxes and a DropDownExtender panel. Several of the textboxes have AutoPostBack set to true, and the whole dialog is created in an UpdatePanel. Okay, so, if youre still following, everything works as expected - however, when one specific Postback is done, all the textboxes are locked up.It only happens in IE7.0. Havent tested in IE6.0, and it does NOT happen in Firefox.You can view the behavior here: http://digiblue.com:280/gasusage.aspx Click on Add Record. Ignoring all the other fields in the dialog, go to the Gallons, and type in a number. (Say, 10.) Then go to "Price Per Gallon" and type a number in there. (Say, 3.009.) Hit tab or go to anoher field, youll notice that the postback works and populated the Total Price. Now click in any textbox (or stay in the Total Price) and try to type. Youll see that you cant. You cant select any text in them, yet the cursor blinks there. The buttons work fine. You can get out of this state by closing (Cancel, OK dosent work yet) and reopening, or opening up the DropDownExtender on Octane.If I disable the backgroundCSSClass, the behavior goes away. (It all works normally.) I tried to search for this, came up empty unfortunately.Thanks in advance for any thoughts. (And yes, the programmings shoddy at this moment, apologies. :) )Mike. . --discussion1:Coyttl:. --discussion2:Hello!No, I havent changed anything on the server, so it should still happen. I get it to occur in IE7.0 on two seperate machines, one 7.0.5730.11, the other .13. It does work fine in Firefox, yes. I haventbeen able to work on it in the last few days due to other projects here at work (thats a side thing Im playing in asp.net with). Cheers,Mike .

Refresh with tabcontrol


Hide Parent ModelPopUp

Question:Hello friends.Well i have given to many answers in this forum.But right now i want help.I have Page in which there is one repeater.In the repeater i have taken one ModalPopUp(Ajax ModalPopUpExtender) which is open on HyperLink link. click(which is reside in repeater)..After open this control there is one Link in the ModalPopUp...Like say Sign Up..When i click on this ModalPopUp i want open new ModalPopUp for the signup..I have opened it too but the now problem is that i want to hide parent ModalPopUp which is opened from Repeater control...Here is sample code structure. Please reply me as soon as possible...... . --discussion1: in page_load event, for lnksignup, add an attribute, so that on click of it, a javascript function will execute. and in that hide the panel1. lnksignup.Attributes.Add("onclick", "javascript:return hidepanel()"); function hidepanel() { document.getElementById("panel1").style.display = none; } similarly for imageclose also, add an attribute, so that on click of it, a javascript function will execute. and in that show the panel1. imageclose .Attributes.Add("onclick", "javascript:return showpanel()"); function Validate() { document.getElementById("panel1").style.display = inline; } .

Dropdown menu in header page is not working when updatepanel is used

Question:Hi All, Am having an header.ascx page which is included in all pages. Insider the header am having a dropdown menu using javascript.It also has count of Items added in cart...now since i want to update the cart count in header when i add anything to cart...i have placed the header insider an updatepanel. Dropdown menu works fine when updatepanel is removed..... My problem occurs when the updatepanel is updated, dropdown menu does not appear. Any help will be highly appreciated.Regards,Rupesh bhatia . --discussion1: your problem appers due to the javascript which is probably not registered. Since you use external javascript files (most probably), use a ScriptManagerProxy in your header page and register your javascript resources so they will be used in the partial page rendering.Use something like this: Hope this helps! Andrei . --discussion2: One more thing... you should use the ScriptManagerProxy in case your ScriptManager is not in the header control and it is added in some parent page like the master page.in case the ScriptManager is in your control user the ScriptManager directly... Andrei .

update updatepanel after childwindow closed

Question:hi!ive a site which opens a modalpopup mp1 (to open a popup i use window.showModalDialog(url, window, param) everywhere).on the mp1 ive an updatepanel up2 inside a multiview inside another updatepanel. inside up2 there is a gridview bound to an objectdatasource.in every row ive a imagebutton which opens another modalpopup mp2. there i can make a few changes and after i colse it, i want the up2 to be updated so that the new values are presented in the gridview.what can i do to make this happen?thanks, kopi_b . --discussion1:Refer this articleshttp://www.aspdotnetcodes.com/Ajax_ModalPopup_PostBack_GridView.aspxhttp://www.aspdotnetcodes.com/ModalPopup_Postback.aspx.

What happens to client side methods, eg getElementById?

Question:I have the following code which works fine in a normal ASP.NET page, where bRefresh is an ASP Button:However, when I have bRefresh in an UpdatePanel, it does not work anymore. What can I do to let getElementById return the expected value?My code is launching a pop-up window to let the user select some data. Upon return, I want to refresh the main page with the selected data (in a Session key), and I am trying to do this by tying the refresh code to a button (bRfresh) click, , which I make display:none. Is there another way to do this better?Thanks.. --discussion1:Never mind your bRefresh button is in UpdatePanel or not. Just call your showModalDialog JavaScript function in the OnClientClient property of bRefresh button. It will sure open the new window. In the openned modal window, while closing, add the below javascript if you are closing with JavaScript event. Or emit this javascript through RegisterClientScriptBlock if your close the window with asp.net script.window.opener.location.reload();self.close();return false;. --discussion2:Use ScriptManager.RegisterClientScriptBlockhttp://www.asp.net/AJAX/Documentation/Live/mref/O_T_System_Web_UI_ScriptManager_RegisterClientScriptBlock.aspx. --discussion3:ameenkpn:.

Update Panel Page with mixed loading

Question:I have a page that has multiple usercontrols on it. One of the user controls loads VERY slowly. Its not always needed either, so my question is how can i allow everything else to load quickly and then show like loading in this user control spot so the user doesnt have to sit with a blank page for a long time?. --discussion1:You can have a boolean/string property in your usercontrol class that tells it whether it has to render itself. Lets say you call it RenderMode. Now, override the Render and the RenderChildren events in your UserControl class and call the base.Render method only if the RenderMode property is set to True/Always. If it is set to False/Conditional, then dont call the base.Render method. This way when you place the control in your page you can specify the RenderMode (which is your custom property) to Conditional for the UserControls that you dont want to render from the word go. When the page posts back change the property to Always if required and the control will be rendered.. --discussion2:Ok i get that but that isnt exactly what Im wanting. I want it to load, but i want the other stuff to load with the quickness and then show a Loading icon or word or something in the area the control goes until its fully loaded. The page has a lot of stuff on it so the user can be busy looking at this and that rather than waiting for the entire page to load to see anything? Make sense?. --discussion3:Like this example. --discussion4:Off the top of my head, you can do this:1] Use an UpdatePanel and a Timer control inside it.You can associate an UpdateProgress control with that UpdatePanel to show the Loading effect.2] Specify a time interval for the Timer control and in its first Tick event, disable the timer and render your control in that area. Since it is inside an UpdatePanel itll render asynchronously and when the page loads for the first time itll load faster since the control that takes a lot of time to load wont load until the page is rendered to the user and the first timer cycle elapses and the Tick event is called asynchronously. .

Grid view with Partial page update concept

Question:Hi , I am a novice with AJAX. Requirement : ElementID would be entered in the text box.And when we click on getElementDetails button,a grid view with data would be displayed.Nearly 700 - 800 records would be returned. Each row contains a dropdown list in one column.When there is change in the drop down selection,entire grid view is being refreshed.The data row whose drop down selection is changed is likely to change.As part of improving the performance,if there is a way to use a separate update panel for each and very row of grid view.... If it is possible,please explain how to implement....Request suggestions that might suit this requirement other than AJAX....if any Thanks in advance. . --discussion1:Hi,When we use Updatepanel, the entire page will be sent to server, and the server sends this Updatepanels new content to client to update. In this case, the Updatepanel reduces the data sent to client side. In your case, if we want to use multiple Updatepanels in page, it would be better that we set the UpdatePanels UpdateModes to Conditional. To do so, we only update the Updatepanel that needs to be updated.You can refer to discussion on http://forums.asp.net/t/1149481.aspx I look forward to hearing from you. .

Invisible button problem when refreshing

Question:Hi,inside an Updatepanel I have a clear button, createNewReportLinkButton, search button and a list of other controls, and Im using this Javascript code (because I had to) to hide the createNewReportLinkButton when the clear button is clicked and its working fine.But the problem is that when I click on search button that pops up an new window (as search screen) and when this popup window is closed,it refreshes the original form and the createNewReportLinkButton become visible again !!? so, how could that be fixed? function SetVisibility{//document.getElementById("createNewReportLinkButton").disabled = truedocument.getElementById("createNewReportLinkButton").style.visibility = "hidden"} Thanks. --discussion1: Hi,You can do something like if you are clicking the close button you can set one flag value for a hidden fileld.Then inside js you have to check the hidden fileld value and according to that hide / show the createnewreportlinkbutton.Call the same jsl in form load .Set hidden field value to false in !isposkback also.Regards Arathi . --discussion2:Well, I called the JS function to hide the createnewreportlinkbutton in Page_Load - because its the event that gets fired after closing the popup window like:Page_Load{... ScriptManager.RegisterClientScriptBlock(UpdatePanel3, typeof(UpdatePanel), "Function", "SetVisibility()", true);} and yes the JS function was called(I checked by debugging), BUT still the same and the createnewreportlinkbutton has been refreshed to be visible!!?Thanks. --discussion3: Hi,As you tried Page_Load{ ScriptManager.RegisterClientScriptBlock(UpdatePanel3, typeof(UpdatePanel), "Function", "SetVisibility()", true);} call the same in click event of clear button also. It is working fine for me.Regards Arathi .

Where to include service reference

Question:Hi, I have a user control which contains a reference to an asmx file with web methods that I call from javascript.I would like to use these methods on other controls on the same page.Do i need to reference the same file in each of the controls although I will use the controls on the same aspx page.Thanks . --discussion1:For user controls it's better to use the invoke() method of the WebServiceProxy class to call the WebService directly instead of registering it with the ScriptManager, check this link: http://www.asp.net/AJAX/Documentation/Live/ClientReference/Sys.Net/WebServiceProxyClass/WebServiceProxyInvokeMethod.aspx.

How to Retrieving data back to DropDownLists in the UpdatePanel?

Question:I am using an Update Panel in my page called Company.aspx for populating Countries and States. There are two dropdownlists for the States and Countries. This is working perfectly fine. In the database, there is a table called Company where the StateId and CompanyId is stored. Now, if I want to display back the Country and State in the particular dropdownlists, how should I do that in the dropdownlists which is in the UpdtePanel? When I try to do as follows, it doesnt give me any error, but not selecting that particular value:ddlCountry.SelectedItem.Value = Codtls.CountryName; // CoDtls.CountryName is a property having the country name.Can anybody pls provide any help to me on this? Any code examples? Thanks in advance for any help.Please let me know if I need to clarify more. . --discussion1: I didnt quite understand what youre trying to do ... can you provide more details? maybe post your code so we can understand better what you want? Andrei . --discussion2:I have two dropdownlist in my form for populating Country and States. When user selects a Country, the corresponding States populates in the State dropdownlist. I have done this using the UpdatePanel. So whenever user selects a country, the States dropdownlist will automatically populated without a postback. While saving the data, Im passing the selected CountryId and StateId.Now, if I want to show those selected values back in the respective dropdownlists from the database, how should I do that? I can get the value from DB, but not able to show those selected values while loading. By default, in the Country Dropdownlist the first item is selected and nothing in StateDropdownlist.For eg: While inserting, if the user selects Country as India and State as Karnataka, then while doing modificiations on the page,those values should be shown as selected in the respective dropdownlists. . --discussion3: Ok.... understood.Your problem is that yourre trying to do this: ddlCountry.SelectedItem.Value = Codtls.CountryName; // CoDtls.CountryName is a property having the country name In order to set an item as selected in the dropdown list you have to set the SelectedIndex property which takes an integer as value. So youll have to iterate through the items of your dropdown (which is simple enough), check if the get the index of the item, check if the value matches the one you need - Codtls.CountryName and if yes set the selectedindex as the index of the item you found. here is a small piece of code that should help you set the desired item as selected:I have this in aspx file: and for example in Page load event I set value c as selected:int pos = 0; foreach (ListItem item in DropDownList1.Items) { if (item.Value.Equals("c")) { DropDownList1.SelectedIndex = pos; break; } else { pos++; } } Hope this helps! Andrei .

How to add AttachmentCollection to my mail message ?

Question:Hi there. Ive a attachment collection kept like:Dim attach as mail.attachmentDim attachList as mail.attachmentCollectionattach = new Mail.Attachment(fileName , System.Net.Mime.MediaTypeNames.Application.Octet)attachList.add(attach)So how can I add my AttachList as a Attachments to my mail message?Cause of the "mail.Attachments.add(attachList)" gives me some error.Thanks.. --discussion1:See: http://www.ddj.com/windows/209000062. --discussion2:Thanks man but your link shows me what Ive done, I want to collect all the multi-attaches in an attachementCollector and send it by the mail.attachments.add().. --discussion3: Check below linkhttp://www.systemnetmail.com/faq/3.4.1.aspx . --discussion4:using System.Net.Mail;......Dim mail as New MailMessage();mail.Attachments.Add(New Attachment(fileName , System.Net.Mime.MediaTypeNames.Application.Octet));mail.Attachments.Add(New Attachment(...);mail.Attachments.Add(New Attachment(...);...This way u can add as many.For further reference u may refer http://www.systemnetmail.com/faq/2.3.aspx If this solves ur query donn forget mark as answered.

website not opening in browser

Question:Hi everybody, I created a new website and when I tried to run, the browser says page cannot be displayed. Any guesses why?ThanksDora . --discussion1: Whats the ACTUAL error message?. --discussion2:There are many reasons why this happens, here are some that i could think of:1. Check if you correctly type the path of your site2 . If you are accessing it in another machine then be sure to publish it first in IIS.. . --discussion3: This is not a big website which I have prepared. .....lets suppose I just wrote "Welcome" in div tag, and tried to run it by pressing F5, the url is ok...but is not displaying the content....but says "Internet Explorer cannot display the webpage"...ThanksDora . --discussion4:dorap:. --discussion5:hi man look on your server the framework may you using another release. --discussion6:Only for Test Remove your LAN Connection Settings in your Browsers if you are using, then check run again..

Does Convert.ToDateTime read dd/mm/yyyy or mm/dd/yyyy?

Question:Hi everyone,I struggled for literally the whole day with this problem.Does the C# Convert.ToDateTIme function read date as "dd/mm/yyyy" or "mm/dd/yyyy"? I have the same application on my local machine which I uploaded to my remote shared server. It was working perfectly on my local machine reading "dd/mm/yyyy", but on my remote machine, it seems to read dates as "mm/dd/yyyy". I have the same culture setting "en-GB" on both. I find this date conversion very unpredictable. Can anyone recommend a culture-proof way of reading date strings from a SQL Server 2000 database? Thanks for the help. . --discussion1:I would use DateTime.Parse or DateTime.ParseExact instead of Convert.ToDate . --discussion2:Thanks for your reply, Ken.I read that Convert.ToDateTime actually calls Parse. What I did instead was this: DateTime dtParam; System.Globalization.CultureInfo enGB = new System.Globalization.CultureInfo("en-GB"); dtParam = Convert.ToDateTime(strdatetimeparam, enGB); It seems to work. . --discussion3:multiplex777:. --discussion4:Hi,Thanks yaar its working fine.... .

how to store selected list box items into sessio arrys....

Question:Hi!I am trying to store the selected items of list box into an seesion. i have tried like this but its not working. on button clickDim i As IntegerFor i = 0 To sub_Cat_list.Items.Count - 1 If sub_Cat_list.Items(i).Selected ThenSession.Add("sub_cat_name", sub_Cat_list.Items(i).Text) End If Nextthen in another page<%=session("sub_cat_name") %> but its not displaying anything.please suggest.thanks in advance..... --discussion1:Why not use ArrayList and store the Collections of your Array in Session like below: Dim arr As New ArrayList() arr.Add(DropDownList1.SelectedItem.Text) Session("arrCollections") = arr Then To get the values of Arrays in Session If Session("arrCollections") IsNot Nothing Then Dim newArr As ArrayList = DirectCast(Session("arrCollections"), ArrayList) For Each item As String In newArr do something Next End If . --discussion2:thanks for ur quick helpi have modified my code acc to ur codeIf Session("sub_cat_name") IsNot Nothing ThenDim newArr As ArrayList = DirectCast(Session("sub_cat_name"), ArrayList)For Each item As String In newArr Response.Write(newArr.Item(0).ToString())NextEnd Ifbut how to write the names of the array. --discussion3:Abitha:. --discussion4: String sub_cat = String.Empty; For i = 0 To sub_Cat_list.Items.Count - 1 If sub_Cat_list.Items(i).Selected Then// getting sub_cat_list_item in CSV format sub_cat += sub_Cat_list.Items(i).Text + ",";End IfNextSession["sub_cat_name"] = sub_cat; In the next page using string handling seperate the values and handle it.ORuse array to store the selected index and store that in a session and handle in next page . --discussion5:Abitha:. --discussion6:ya i got the solution sir.thank u.the working code is:Dim arr As New ArrayList() For i = 0 To sub_Cat_list.Items.Count - 1If sub_Cat_list.Items(i).Selected Then arr.Add(sub_Cat_list.Items(i).Text)Session("sub_cat_name") = arr End If Nextthen in another pageDim newArr As ArrayList = DirectCast(Session("sub_cat_name"), ArrayList) Dim i As IntegerFor i = 0 To newArr.Count - 1 For Each item As String In newArrResponse.Write(newArr.Item(i).ToString() & "
") Nextofcourse which u specified. thanks Cebu. . --discussion7:Abitha :.

Shall they be static or non-static method?

Question:Im write an easy asp.net 2.0 web site which can be used by multiple users of course, and meet one problem with my DAO objects. They are like this. public class UserDao{ public String static getNameById( int id) { ... ... } } Shall I make the methods of DAO object static and call them directly or non-static and call them in a new instance? Will it cause problems of synchronization if the method is called multiple times at the same time? Will they affect each other? Thanks, adun . --discussion1:For synchronization, you have to look at the code and think about it. If its all self contained (doesnt acces a field of the class instance), usually its fine (as the database will handle most concurrency issues).Generally, if you can help it, dont make methods static. The day you want to start using unit testing or many design patterns, inheritance, etc, youll be thankful for it. Static methods cannot be overriden, and for many reasons arent as flexible. Its not the end of the world, and static does have some advantages, but as a general rule, if youre ever hesitating, go non-static. If you have no choice, then static will be fine.. --discussion2: I see, thanks. .

DAL on only one class

Question: Hi,I have a basic question. Im creating my DAL for my CMS. Should i create one class(DAL) for all my objects or should i create many DAL for each objects . Ex. Customer = CustomerDAL product = ProductDAL Etc. Or, all my object (Customer, product,...) = MyDAL Thanks . --discussion1: One for each object. --discussion2:Theres no need to create multiple DALs..Just create only a single DAL class for all your objects, and create a SEPARATE methods within your class where you have your objects for calling the DAL..See if these helps: http://geekswithblogs.net/dotNETvinz/archive/2008/02/01/creating-a-data-access-framework-again.aspx http://www.15seconds.com/issue/030317.htmhttp://www.15seconds.com/issue/030401.htm. --discussion3:This really is a matter of preference. I personally prefer a separate class for each table in my db. . --discussion4:Not sure what you really mean. But it seems you are talking about modeling instead of DAL (data access layer)?I suggest , which is based on other peoples recommendations, that you create a seperate class for each entity in your project. . --discussion5:Ok thank you. .

SyncLock - save and lock uploaded file

Question:Hi All,I dont think the code I have written functions correctly... I am trying to lock code in part of an ASPX page. I think I have locked the code for each instance of the page running, when really i want to lock the code for all of the instances of the page that are running on the server.The reason for this is that after uploading a file from a web form I am having to save it on my server before attaching it to an email (the reason for this is that I need to use system.web.mail which unlike system.net.mail will now allow me to use an input stream for the file attachment). I am worried that two people upload a file with the same name, and one file overwrites the other, so, i would like the code that saves the file, attaches it to the email, sends the email and deletes the file, to be synchronised.Can anyone tell me if the code I have written does this, and if not, how I could achieve this?Thanks, Daniel Sub SendEmail()Dim myEmail As New System.Web.Mail.MailMessagemyEmail.To = "test@test.gov.uk"myEmail.From = "test@test.gov.uk"myEmail.Subject = "Ill Health Retirement Request Form"myEmail.BodyFormat = System.Web.Mail.MailFormat.HtmlmyEmail.Body = buildEmail()SyncLock MeDim tempFileName() As StringtempFileName = SicknessRecord.PostedFile.FileName.Split("\\")System.IO.Directory.CreateDirectory("c:\tempUpload\")SicknessRecord.PostedFile.SaveAs("c:\tempUpload\" + tempFileName(tempFileName.Length - 1))myEmail.Attachments.Add(New System.Web.Mail.MailAttachment(("c:\tempUpload\" + tempFileName(tempFileName.Length - 1))))System.Web.Mail.SmtpMail.SmtpServer = "excon"System.Web.Mail.SmtpMail.Send(myEmail)System.IO.File.Delete("c:\tempUpload\" + tempFileName(tempFileName.Length - 1))End SyncLockEnd Sub . --discussion1:Hi,That appears as though it would work fine - have you tested it? . --discussion2:Hi Mr^B!Thanks for your reply. Im not really sure how to test it... I dont think that submiting the pages at the same time would be a accurate enough test...Any suggestions?. --discussion3:danielz000:. --discussion4:Hi Shengqing! That little trick crossed my mind too... I decided against it on the grounds a random number could potential be picked twice and if that ever happened on the sever Id never spot where the bug was... Thought it would be better to stick to propery programming practices and sync the code...Cheers, Daniel. --discussion5:danielz000:. --discussion6:Hi Shengqing and thanks for your reply.I ended up using the random folder name as you suggested but then came up against the problem again. This time however the problem was based around a counter for the page... because of this, the random folder name could not be used. In an attempt to ensure that only one page was running a section of code at a time I tried SyncLock Me, with the use of some thread sleeps I discovered that SyncLock Me does not work. I assume its locking on an instance of the page, and each page running, is its own instance... So I tried the following code, (which does worked...) However, no im wondering who/what objLock is shared with... Is it only instances of that page? Also, does a new object get created each time the page is loaded by a user or is the object only ever created once? (i dont want to start eating all of the servers RAM)If anyone could enlighten me as to what is actually happening behind the scenes that would be great! Also, any opinions on best practices would be great too!Many thanks, Daniel. --discussion7:Hi,The Shared object is only created once, so each instance of the page refers to only one instance of objLock, and each user has access to objLockWhats going on behind the scenes is that the first person to call SyncLock on objLock will prevent other threads/users from doing the same. Their process will just sit, waiting for objLock to be released (on End SyncLock) and then the first process to execute will grab a lock on it, and all the others have to wait again.static/shared objects are a very reasonable way of dealing with locking issues, you will commonly see them used with "singleton" type design patterns in order to make any singleton objects "threadsafe"."Threadsafe" just means that you dont get unexpected behaviour out of your objects if more than one thread tries to use/consume them at the same time. . --discussion8:Cheers Mr^B,Thanks for confirming that the shared object is only created once.I actually had a fairly good understanding of synchronisation from Java but from a .Net point of view, that was a very helpful post for me, and im sure it will be for many other people too!There were very few details on syncing ASP pages on the net. Most of what I found was for syncing normal programs, which would lead you to think that SyncLock Me is a good idea for locking bits of code of a ASP page...Any way, I hope that this post becomes useful post for other people too!Daniel.

AsyncController

Question:Howdy,Ive left my AsyncHttpHandler how it is and added it to our project with a note/plan to upgrade to an AsyncController later. using Controllers for async actions are more attractive because its easier to test and can use our plethora of filters, controller helpers, etc weve created. I was hoping the beta would include the AsyncController, but I dont see it. No biggie, but it may change my plans in the future.Does MS intend to provide an AsyncController for RTM? Or, should I not rely on MS for this feature and just use Steve Sandersons AsyncController?Im just curious is all so I can plan for the future.- CV. --discussion1:Hi CV,We plan to at least give out a sample AsyncController at some point prior to the final release of ASP.NET MVC 1.0. Im afraid I cant say anything more than that at this point because thats all weve decided so far.Thanks,Eilon.

Problem with the Listview control

Question: HiI am having problem with the listview control. I am having a listview and i need the selectedvalue of the row selected.Please help me.. --discussion1:Use the ListView SelectedValue property. Something like this:myListView.SelectedValue.ToString() . --discussion2: hai jyoti send me the source code so i will write the exact coding for ur selected row . --discussion3:Thanks for your response. I want to pass the listview selected value as parameter to one object datasource without writing any code in code behind and just working on the design side.Is it possible? .

memory leak detection tool for c# assembly in .net

Question:Hiwe need to fing the memory leaks in c# assembly.Is there any tools to detect memoryleaks in c# assembly?. --discussion1: Try this http://www.microsoft.com/downloads/details.aspx?familyid=86ce6052-d7f4-4aeb-9b7a-94635beebdda&displaylang=en.

differance between Platfrom and language independence

Question:please anyone can let me know the differance between Platfrom and language independence is .net 2.0 platform independence or lanuage independence..Can any one help me out with elobration and example. With Regards Ameya. --discussion1: http://dng-dotnetframework.blogspot.com/2007/05/what-is-net-platform.htmlMicrosoft .NET is a software development platform based on virtual machine architecture. Dot Net Platform is:Language Independent – dot net application can be developed different languages (such as C#, VB, C++, etc.)Platform Independent – dot net application can be run on any operating system which has .net framework installed.Hardware Independent – dot net application can run on any hardware configuration. It allows us to build windows based application, web based application, web service, mobile application, etc.. --discussion2:Plateform refer to Your Operting system such as Windows Xp, Linux, etc.While Language refer a single language such as VB, C#, etc.Independent means these are not dependent on any language or Opertaing system..

how AutoCompleteExtender return 2 var, same a dropdownlist

Question:hy I can work very good wiht the AutoCompleteExtender, how can i get 2 parameter and put in a label for examplecod, descripction1, one2, ones3, onnesin my textbox, i write one, i give enter, and write one, but i want in a label write 1labe1.text=1 textbox1.text=onehow . --discussion1:Hi,Please check the below sample:

CascadingDropDown - initial values from server

Question:I have a user control that displays multiple DropDownLists (can really be a lot) in the form:Row1: DropDownList1 -> CascadingDropDownList1 ->CascadingDropDownList1Row2: DropDownList2 -> CascadingDropDownList2 ->CascadingDropDownList2... I create these controls in a loop like this: TableCell cellFunction = new TableCell(); row.Cells.Add(cellFunction); ExtendedDropDownList ddlFunction = new ExtendedDropDownList(); ddlFunction.ID = String.Format("ddlFunction_{0}", i); cellFunction.Controls.Add(ddlFunction); TableCell cellOperator = new TableCell(); row.Cells.Add(cellOperator); ExtendedDropDownList ddlOperator = new ExtendedDropDownList(); ddlOperator.ID = String.Format("ddlOperator_{0}", i); cellOperator.Controls.Add(ddlOperator); AjaxControlToolkit.CascadingDropDown cddOperator = new AjaxControlToolkit.CascadingDropDown(); cddOperator.ID = String.Format("cddOperator_{0}", i); cddOperator.TargetControlID = String.Format("ddlOperator_{0}", i); cddOperator.ParentControlID = String.Format("ddlFunction_{0}", i); cddOperator.Category = this.View.QueryTarget; cddOperator.ServicePath = "~/services/ViewBuilder.svc"; cddOperator.ServiceMethod = "GetQueryOperators"; cellOperator.Controls.Add(cddOperator); The control also populates all initial values for the DropDownLists and sets the initial selections, so the CascadingDropDown is only needed when the user selected a different value from the one that is originally selected. As it is now it works like this:All e.g. 20 DropDownLists display OK, the 20 CascadingDropDownExtenders make the web service calls to populate the DropDownLists with exactly the same values which are already there. Is there a way to prevent the initial populate calls from the CascadingDropDowns so that they accept whatever is populated by the server and only repopulate when the selected value of the parent control changes?. --discussion1:Hi, John.Doe:.

VaryByHeader="Referer" not varying in Cache

Question:I have a page with the following directive:<%@ OutputCache Duration="30" VaryByParam="None" VaryByHeader="Referer"%>The code behind has the following: Dim dt As New DataTable() Dim row As DataRow Dim i As Integer dt.Columns.Add("Header") dt.Columns.Add("Value") With Request.Headers For i = 0 To .Count - 1 row = dt.NewRow row(0) = .GetKey(i) row(1) = .Item(i) dt.Rows.Add(row) Next End With gvHeaders.DataSource = dt gvHeaders.DataBind()This fills a GridView with the Header information, including the Referer.The page can be requested through two different URL's (Caching.aspx and Referer.aspx.) as well as a submit button on the page itself. The submit button on the form will always change the Referer displayed if the previous Referer was one of the different URLs. The two URL's will always change the Referer displayed if the last request was through the submit button on the form itself.The problem I am having is the Referer does not seem to change until after expiration if I request the page from one of the different URLs. i.e.: I request the page from Caching.aspx and the Referer shows Caching.aspx, I then request the page using Referer.aspx but the Referer still shows as Caching.aspx, the reverse also happens, page requested first through Referer.aspx, and then Caching.aspx but Referer still shows as Referer.aspx.This will happen even with two different instances of I.E. 7 or two different instances of FireFox, but it does not occur between I.E. and FireFox.I am guessing that it has something to do with local cache but have not been able to find anything confirming that.Can someone please give me some insight to the behavior?. --discussion1:Adding Location="Server" produces the behavior I was expecting. Apparently where it was working without location was because the submit button forces a post back. It seems that when the cache is on the client it doesn't care what link (Referer) was used to reach the page when using VaryByHeader="Referer". This behavior makes sense for efficient cache utilization. Just a little frustrated that I haven't been able to find anything that documents or confirms that fact beyond my own analysis. .

SQLExpress database file auto-creation error: Web Parts

Web Parts Demo


Change edited values in RowUpdating Event? (Gridview)

Question:I have customized a gridview to do bulk editing. I fire the UpdateRow command from a buttonclick event like so: Protected Sub btnUpdate_Click(ByVal sender As Object, ByVal e As EventArgs)Dim i as Integer = 0Do While (i < Gridview1.Rows.Count)Gridview1.UpdateRow(i, True)i = (i + 1)LoopGridview1.DataBind()End Sub My issue is, I need to be able to grab the value that the user enters in the "Description" field, and append some more data to it before the row is updated. For example, if the user enter "Blackfeet", I need to append "1111" to that after the user clicks the Update button, but before the row is updated. I thought the rowupdating event was the place to do that, so I wrote the following method:Protected Sub Gridview1_RowUpdating(ByVal sender As Object, e as GridviewUpdateEventArgs)Dim row as GridviewRow = Gridview1.Rows(e.RowIndex)Dim txtDescription as Textbox = TryCast(row.FindControl("txtDescription"), TextBox)Dim lblDescription as Label = TryCast(row.FindControl("lblDescription"), Label)If e.RowIndex = (Gridview1.Rows.Count - 1) Then // Im only interested in changing the field for the last rowtxtDescription.Text = txtDescription.Text + "1111" //append 1111 to the end of whats in the textboxlblDescription.Text = txtDescription.Text // set the labels text propertyEnd IfEnd Sub A couple things to note:1) the textbox and the label are inside an ItemTemplate. The textbox is visible when the gridview is in "edit mode", and the label is visible when the gridview is in "normal mode"2) When I place a breakpoint in the rowupdating method, it looks like the values are changed as I would expect them to be. But when the Gridview displays, the "1111" isnt there - but the changes made by the user are!Any suggestions? . --discussion1:Hi juriggs,If the textbox and label are bound to data source, you neednt to set the text manually. In RowUpdating event you can only update the text manually.For example (I suppose you bind GridView with SqlDataSource): Protected Sub Gridview1_RowUpdating(sender As Object, e As GridviewUpdateEventArgs) SqlDataSource1.UpdateParameters("description").DefaultValue = DirectCast(GridView1.Rows(e.RowIndex).FindControl("txtDescription"), TextBox).Text + "1111" set other update parameters SqlDataSource1.Update() End SubThanks,.

ASP.Net Code Repository

Hello!I have a home server, and am looking to setup a web application thatll simply just store files (code samples, projects, etc). Is there an existing open source application thatll do this, thatll run through IIS? Thanks! discussion1:trey searching here www.codeplex.com

merging a forum application with my web application

hi i wanted to design a forum page for my web applcation using vb.net and asp.net but keep hitting dead ends. Then I read somewhere online about already made open source forums that can be used in web applications. Can anyone point out where i can get a forum to put in my application and how i integrate it with my code? And information on how to create my own forum page in vb and asp.net would be helpful. Really want to learn how to do it.Thanks discussion1:I would suggest you YetAnotherForum http://www.yetanotherforum.net

can the extenders be put insinde a skin file?

Question:can a contrrol extander from the toolkit be put inside a skin file inside a theme folder? and then be themed?. --discussion1:bcweed966,Yes you can. You just need to remember to register your control at the top of you skin file like this (using the tagprefix you define in your pages, of course):<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> James.

Version conversion

Question: Hi,I developed an asp.net code in the process of building a website using version 1.1 and now due to some deployment problem at the client sever since it uses version 2.0, i was asked to convert the code into 2.0 and then compile the code to submit it to the client and i did so by using some third party conversion tools but the client keeps complaining that the server pops up error ..could some one please explain me the ways how to convert my code into 2.0 and deploy at client side without any errors..Do i need to make any changes in the older version of web.config code to work properly or do shall i ask the client to make chnages in config settings of the server. Niths . --discussion1:neeths:.

Connection issue with SQL and the Hosted Site

Hi, I have displayed the error below and would like some help in resolving it. I have a site hosted by "Go-daddy" and my logon.aspx is evidently not communicating with the SQL database. Any assistance you can provide will be appreciated. Server Error in / Application. An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) 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.Data.SqlClient.SqlException: An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [SqlException (0x80131904): An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)] System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +800131 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +186 System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject) +737554 System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject) +114 System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart) +421 System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +181 System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +173 System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +133 System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +30 System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +424 System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +66 System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +494 System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +82 System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +105 System.Data.SqlClient.SqlConnection.Open() +111 System.Web.DataAccess.SqlConnectionHolder.Open(HttpContext context, Boolean revertImpersonate) +84 System.Web.DataAccess.SqlConnectionHelper.GetConnection(String connectionString, Boolean revertImpersonation) +197 System.Web.Security.SqlMembershipProvider.GetPasswordWithFormat(String username, Boolean updateLastLoginActivityDate, Int32& status, String& password, Int32& passwordFormat, String& passwordSalt, Int32& failedPasswordAttemptCount, Int32& failedPasswordAnswerAttemptCount, Boolean& isApproved, DateTime& lastLoginDate, DateTime& lastActivityDate) +1121 System.Web.Security.SqlMembershipProvider.CheckPassword(String username, String password, Boolean updateLastLoginActivityDate, Boolean failIfNotApproved, String& salt, Int32& passwordFormat) +105 System.Web.Security.SqlMembershipProvider.CheckPassword(String username, String password, Boolean updateLastLoginActivityDate, Boolean failIfNotApproved) +42 System.Web.Security.SqlMembershipProvider.ValidateUser(String username, String password) +83 System.Web.UI.WebControls.Login.OnAuthenticate(AuthenticateEventArgs e) +160 System.Web.UI.WebControls.Login.AttemptLogin() +105 System.Web.UI.WebControls.Login.OnBubbleEvent(Object source, EventArgs e) +99 System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35 System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +115 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +163 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746thanks in advance. You may email me if you wish at: hanfjohns@q.comdiscussion1:Hi,this is nearly always that the connection string is incorrect. Check your database username and password are correct. Also check the data source is pointint to the SQL server ip address, or sometimes you can just use localhost as the data source.JC

textbox textchanged event in gridview

Question:any example of gridview update . . --discussion1:Try searching on GridView in this forum. I, myself, have posted many examples including ones with TextBox Template columns, and others have also.NC... .

Checkboxlist Alignment in FireFox

My checkboxlist aligns all checkboxes nicely to the right in IE. But in FireFox, they are centered. How can I make sure I align them all either right or left (so that they show up in a nice 2 column line) in both Firefox AND IE respectively?heres how it is set, which aligns them in 2 columns and the boxes are vertically aligned flush to the right:1 2 3 4 5 I believe my td tag aligns the boxes. Im sure theres a style I can use that would work both in IE and FireFox? I remember having trouble even getting them to align flush in IE initally and had to add that attribute in the tag in order to even get them to align nicely somehow in the first place.discussion1:Not sure what you are trying to do, but a CheckBoxList (or RadioButtonList for that matter) renders as a table tag with the CheckBoxes in the table nodes. Set the style attribute of the CheckBoxList to change the alignment of the nodes.In the CodeBehind: CheckBoxList1.Style.Add("text-align", "right");NC...

about password encryption

hi every body i posted a comment befour but i think no one understand thats why the answer was not satisfactory.my problem is that when user login my site they go to a page where they buy dsl cards once they have entered their password to the login page now the user before clicking "buy" button he will have to enter his user name and password again. after that it checks and when find correct the application display cards numbers.the problem is that the pasword is encrypted by asp.net and is stored in aspnet_membership table in database, i want to encrypted password entered by the user and then my created procedure will check it with the password in the database so tell me what i do for that.discussion1:I dont know if I got your point, but try to use FormsAuthentication.Authenticate() method to verify the user credentials

Moving a VS 2005 Web Project to another Computer

Question:I just started working for a firm who had a few fly-by-night developers who created a huge website using VS2005 and possibly 2008 (both are installed on the machine). We open the project in 2005 but from what I can tell it is using the .net 3.5 framework. We do not want to migrate the project to 2008. The project also uses an abundance of 3rd party software including:SubSonicNUnitTelerik Rad ControlsRss ToolkitAJAX ToolkitThe problemI just graduated and am very new to .net. I need to make simple text edits to the site but cant compile the site on my local machine. It compiles fine on the old developers machine. I used Tortoise SVN to aquire the project files. I also installed all of the 3rd party software and the .net frameworks up until 3.5. I have added reference files to the GAC and bin for the third party vendors but continue to get compile error after compile error due to the missing assemblies for the third party vendors. I really have no idea what I am doing but no one else here can help me. Is there an easier way to do this?. --discussion1:What errors are you facing during compilation? Have you referenced all your third party assemblies in your web project references? Technically, it should work with all the DLLs in the bin folder and such but still try this: Right click on the web project in the solution explorer and click on the Add References option and add all the external DLL references that you need..

Password recovery by entering email not username

Question:Hi,I am using the ASP.Net password recovery control. By default the user needs to enter their username before an email gets sent out to them.If it possible instead of entering the username, email is used instead? Alot of my users forgets their username but not email.thanks . --discussion1:Hi unggy,I am using the ASP.Net password recovery control. By default the user needs to enter their username before an email gets sent out to them.If it possible instead of entering the username, email is used instead? Alot of my users forgets their username but not email..

Collapseable Panel Issue

Question:

 I have 2 parts to a web form with the bottom half of the form exposed by the collapseable panel.

There is only one button. The problem is the that required field validator is being triggered for the address field even when this panel is not visible? I only want the second validator to be triggered if they have clicked to show the lower panel.

Thanks

Steve

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default2.aspx.vb" Inherits="Default2" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

<!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">
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="sc1" runat="server"></asp:ScriptManager>
    <div>
        <asp:ValidationSummary ID="ValidationSummary1" runat="server" />
   
           <asp:Label ID="lblLname" runat="server" Text="Last Name"></asp:Label> <asp:TextBox ID="txtLname" runat="server"></asp:TextBox><asp:RequiredFieldValidator
               ID="RequiredFieldValidator1" ControlToValidate="txtLname" runat="server" ErrorMessage="Last Name is required">*</asp:RequiredFieldValidator>
            <asp:Panel ID="Panel2" runat="server" CssClass="collapsePanelHeader" Height="30px">
            <div style="padding:5px; cursor: pointer; vertical-align: middle;">
                <div style="float: left;">want to complete more form data?</div>
                <div style="float: left; margin-left: 20px;">
                    <asp:Label ID="Label1" runat="server">(Show Details...)</asp:Label>
                </div>
                <div style="float: right; vertical-align: middle;">
                    <asp:ImageButton ID="Image1" runat="server" ImageUrl="~/images/expand_blue.jpg" AlternateText="(Show Details...)"/>
                </div>
            </div>
        </asp:Panel>
        <asp:Panel ID="Panel1" runat="server" CssClass="collapsePanel" Height="0">
            <br />
            <p>
                <asp:Label ID="lblAddress" Text="Address" runat="server"></asp:Label><asp:TextBox ID="txtAddress" runat="server"></asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" ControlToValidate="txtAddress" runat="server" ErrorMessage="Address Validator">*</asp:RequiredFieldValidator>
            </p>
        </asp:Panel>
    </div>
    <asp:Button ID="btn1" runat="server" Text="Submit" />

    <cc1:CollapsiblePanelExtender ID="cpeDemo" runat="Server"
        TargetControlID="Panel1"
        ExpandControlID="Panel2"
        CollapseControlID="Panel2"
        Collapsed="True"
        TextLabelID="Label1"
        ImageControlID="Image1"   
        ExpandedText="(Hide Details...)"
        CollapsedText="(Show Details...)"
        ExpandedImage="~/images/collapse_blue.jpg"
        CollapsedImage="~/images/expand_blue.jpg"
        SuppressPostBack="true"
        SkinID="CollapsiblePanelDemo" />
    </div>
    </form>
</body>
</html>
 

 


discussion1:

Hi,

From your description, I understand that you would like to disable the Validator when the Panel is collapsed and enable it when the Panel is expanded.

To achieve your goal, we need post-back a dummy button's click event to change the Validator's state and the CollapsiblePanel's collapse/expand state.

Please refer to my test code and the comment:

.aspx file 

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="TestValidatorInCollapsiblePanel.aspx.vb"      Inherits="SoluTest_CollapsiblePanel.TestValidatorInCollapsiblePanel" EnableEventValidation="false" %>    <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>  <!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">  <head runat="server">      <title></title>        <script type="text/javascript">          // We need post back when the Title is clicked.          function TitleClicked(title, args) {              __doPostBack('btnTarget', 'click');          }      </script>        <link href="StyleSheet.css" rel="stylesheet" type="text/css" />  </head>  <body>      <form id="form1" runat="server">      <div>          <asp:ScriptManager ID="ScriptManager1" runat="server" />          <div>              <asp:ValidationSummary ID="ValidationSummary1" runat="server" />              <asp:Label ID="lblLname" runat="server" Text="Last Name"></asp:Label>              <asp:TextBox ID="txtLname" runat="server"></asp:TextBox>              <asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="txtLname"                  runat="server" ErrorMessage="Last Name is required">*</asp:RequiredFieldValidator>              <asp:Panel ID="Panel2" runat="server" CssClass="collapsePanelHeader" Height="30px"                  onclick="TitleClicked(this,event)">                  <div style="padding: 5px; cursor: pointer; vertical-align: middle;">                      <div style="float: left;">                          want to complete more form data?</div>                      <div style="float: left; margin-left: 20px;">                          <asp:Label ID="Label1" runat="server">(Show Details...)</asp:Label>                      </div>                      <div style="float: right; vertical-align: middle;">                          <asp:ImageButton ID="Image1" runat="server" ImageUrl="~/images/expand_blue.jpg" AlternateText="(Show Details...)" />                      </div>                  </div>              </asp:Panel>              <asp:Panel ID="Panel1" runat="server" CssClass="collapsePanel" Height="0">                  <br />                  <p>                      <asp:Label ID="lblAddress" Text="Address" runat="server"></asp:Label><asp:TextBox                          ID="txtAddress" runat="server"></asp:TextBox>                      <asp:RequiredFieldValidator ID="RequiredFieldValidator2" ControlToValidate="txtAddress"                          runat="server" ErrorMessage="Address Validator">*</asp:RequiredFieldValidator>                  </p>              </asp:Panel>          </div>          <asp:Button ID="btn1" runat="server" Text="Submit" />          <%--The dummy button to call post-back--%>          <asp:Button ID="btnPostBack" runat="server" Style="display: none" />          <cc1:CollapsiblePanelExtender ID="cpeDemo" runat="Server" TargetControlID="Panel1"              ExpandControlID="Panel2" CollapseControlID="Panel2" Collapsed="True" TextLabelID="Label1"              ImageControlID="Image1" ExpandedText="(Hide Details...)" CollapsedText="(Show Details...)"              ExpandedImage="~/images/collapse_blue.jpg" CollapsedImage="~/images/expand_blue.jpg"              SuppressPostBack="false" SkinID="CollapsiblePanelDemo" />      </div>      </form>  </body>  </html>
.aspx.vb file 
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load        End Sub        Protected Sub btnPostBack_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnPostBack.Click            If cpeDemo.ClientState = "false" Then              ' The CollapsiblePanel is collapsed.              RequiredFieldValidator2.Enabled = False              cpeDemo.ClientState = "true"          Else              ' The CollapsiblePanel is expanded.              RequiredFieldValidator2.Enabled = True              cpeDemo.ClientState = "false"          End If      End Sub
Note: you can post-back any server-side event as you prefer.

Have my code helped?

Best regards,

Zhi-Qiang Ni


discussion2:

 Thank you Zhi-Qiang Ni,

but unfortunately the code snippet didnt' work - but I did appreciate you trying.

 

Thanks

Steve



SQL Server Session Mode in ASP.Net 2.0

Question:

Hi,

My web application was using "InProc" as the session mode. Due to, session crashes etc. I've changed the session mode to "SQLServer". But it was giving the following error message, when I tried to run the application :

 "Unable to serialize the session state. In 'StateServer' and 'SQLServer' mode, ASP.NET will serialize the session state objects, and as a result non-serializable objects or MarshalByRef objects are not permitted. The same restriction applies if similar serialization is done by the custom session state store in 'Custom' mode.

 Help at the earliest on this would be appreciated.

 Thanks n Regards,

Praji


discussion1:

Hi man ,

 

Have u sorted out this problem yet

 

regards



Ajax Autofill extender

Question:

 Hi,

 

I am trying to use the ajax autofill extender, the control to validate is a textbox. When the user starts typing in the stock quote symbol , the extender should call the webservice method which inturn retrieves the symbols from the database.  My following code is not working, I do not understand why. Any help will be immensely appreciated. Thanks.

Code:

Webservice:

<System.Web.Services.WebService(Namespace:="http://abcd.org/")> _
<System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<System.Web.Script.Services.ScriptService()> _
<ToolboxItem(False)> _
Public Class Autofill1
    Inherits System.Web.Services.WebService

    <WebMethod()> _
       Public Function auto1(ByVal str As String, ByVal count As Integer) As IList
        Dim sql1, hint, val As String
        sql1 = "select StockCode from Stock where StockCode like '" & str & "%' order by StockCode"
        Dim connect As New SqlConnection("Data Source=abcd;Initial Catalog=abcd;User ID=abcd;password= abcd")
        connect.Open()
        Dim cmd As New SqlDataAdapter(sql1, connect)
        Dim da As New DataTable
        cmd.Fill(da)
        Dim items As New List(Of String)
        Dim i As Integer = 0

        For Each dr As DataRow In da.Rows
            If (i < count) Then
                items.Add("'" + dr(0).ToString + "'")
                i = i + 1
            Else
                Exit For
            End If
            Next
End Function

 

Client:

<asp:ScriptManager ID="ScriptManager1" runat="server" >
        <Services>
        <asp:ServiceReference Path="Autofill1.asmx" />
        </Services>
        </asp:ScriptManager> 

 <cc1:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server"

TargetControlID="Textbox1" ServicePath="Autofill1.asmx" ServiceMethod ="auto1"  MinimumPrefixLength="1" CompletionSetCount="20" EnableCaching="true" >
    </cc1:AutoCompleteExtender>
       


discussion1:

netBeginner,

The return type for your web method, I believe, should be a String array rather than an IList interface.  Try making that change and see if it works.

James


discussion2:

 I made the `type array, that did not work.. the only other type is string array converter, there is not stringarray


discussion3:

 Hi ,

I made the return type string() ,but its still not working.


discussion4:

 I noticed that in the client side, the tad reads <cc1:Autocompleteextender... but i am not sure why it says that instead on <ajaxtoolkit:..  could that be the problem ?



JScript Object expected error with Custom Validator Control

Question:

Hi all

when I use a custom validator on my dropdown server control to validate client side, if I put the javascript function inline in my aspx file it works fine. If I put it in my external js file then I get the JScript runtime error: object expected. Anyone any idea what is going on? I then just tried a simple function that just returns false and even that fails as well from my external js file. Here is the full function:

function testerman(sender, args)
{
      if (args.Value == 2 && document.getElementById('ctl00_MainContent_Release').value == 3)
      {
         args.IsValid = false;
         return;
      }

    args.IsValid = true;

}

Markup:

<asp:CustomValidator ID="CustomValidator2" runat="server" ClientValidationFunction="testerman"
                    ControlToValidate="ddlProduct" ErrorMessage="Oops!" ValidationGroup="ConfigureNew">*</asp:CustomValidator>

 The external js file is referenced from my aspx file like this:

  <script type="text/javascript" src="../Scripts/helper.js" ></script>

  Any help appreciated.


discussion1:

By the sounds of it (with return false failing the same way) it seems the error means that it cant find the definition of testerman().

Are you sure that your path to the scripts folder is correct? Have you tried putting an alert() in the top of it to make sure that its being included properly?

Check your path.

If you add runat="server" into your <script> tag then you can use the ~/Scripts/helper.js notation.

 

Also you shouldnt be using the id like that in your getElementById call. The id you are using is generated by asp.net and may change. You can ask asp.net to provide you with the id that it has generated by referencing it like this:

getElementById(Release.ClientId)

Presuming your ddl is called Release.


discussion2:

 thanks for the response. That's what I concluded as well, but I didn't understand why because I have other functions in the js file that are seen just fine from the same page. I finally figured it out today (sleep helps) - my browser was caching the js file! Grrr! As soon as I cleared my cache in IE, it worked fine.

Thanks for the tip on the ClientId - I made that change and it works fine.

Regards

Andrew.



System.Security.SecurityException: Request failed

Question:

This page worked fine in framework 1.0 but since we upgraded to 2.0 this page comes up with this error

the part of the page which is the problem is the visits portion the direct data to label controls work fine.  If anyone has any idias Please help

Security Exception

Description: The application attempted to perform an operation not allowed by the security policy.  To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.

Exception Details: System.Security.SecurityException: Request failed.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[SecurityException: Request failed.]     System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Assembly asm, PermissionSet granted, PermissionSet refused, RuntimeMethodHandle rmh, SecurityAction action, Object demand, IPermission permThatFailed) +150     System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Object assemblyOrString, PermissionSet granted, PermissionSet refused, RuntimeMethodHandle rmh, SecurityAction action, Object demand, IPermission permThatFailed) +100     System.Security.CodeAccessSecurityEngine.CheckSetHelper(PermissionSet grants, PermissionSet refused, PermissionSet demands, RuntimeMethodHandle rmh, Object assemblyOrString, SecurityAction action, Boolean throwException) +284     System.Security.PermissionSetTriple.CheckSetDemand(PermissionSet demandSet, PermissionSet& alteredDemandset, RuntimeMethodHandle rmh) +69     System.Security.PermissionListSet.CheckSetDemand(PermissionSet pset, RuntimeMethodHandle rmh) +150     System.Security.PermissionListSet.DemandFlagsOrGrantSet(Int32 flags, PermissionSet grantSet) +30     System.Threading.CompressedStack.DemandFlagsOrGrantSet(Int32 flags, PermissionSet grantSet) +40     System.Security.CodeAccessSecurityEngine.ReflectionTargetDemandHelper(Int32 permission, PermissionSet targetGrant, CompressedStack securityContext) +123     System.Security.CodeAccessSecurityEngine.ReflectionTargetDemandHelper(Int32 permission, PermissionSet targetGrant) +54  


Version Information: Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET Version:2.0.50727.3053

 

 

this is the page code

 

 

<%@ Page Language="VB" StyleSheetTheme="" Debug="true"%>

<%@ Import Namespace="System.Data" %>

<%@ Import Namespace="System.Data.SqlClient" %>

<%@ Register src="_Header.ascx" tagname="_Header" tagprefix="uc1" %>

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

<script runat="server">

Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)

Dim conMyData As SqlConnection

Dim cmdSelectdc As SqlCommand

Dim dtrCustomer As SqlDataReader

If Not IsPostBack Then

conMyData = New SqlConnection(ApplacationUtilities.Epic_Computer_Common.AppUtilities.GetAppSetting("ConnString"))

conMyData.Open()

cmdSelectdc =
New SqlCommand("Select account_number, user_name From customers", conMyData)

dtrCustomer = cmdSelectdc.ExecuteReader()

 

dropCustomer.DataSource = dtrCustomer

dropCustomer.DataTextField = "user_name"

dropCustomer.DataValueField = "account_number"

dropCustomer.DataBind()

dtrCustomer.Close()

conMyData.Close()

End If

End Sub

Sub Button_Lookup(ByVal s As Object, ByVal e As EventArgs)

Dim conMyData As SqlConnection

Dim cmdSelect As SqlCommand

Dim result As SqlDataReader

conMyData = New SqlConnection(ApplacationUtilities.Epic_Computer_Common.AppUtilities.GetAppSetting("ConnString"))cmdSelect = New SqlCommand("cps_CustomerDetail", conMyData)

cmdSelect.CommandType =CommandType.StoredProcedure

cmdSelect.Parameters.AddWithValue(
"@account_number", dropCustomer.Text)

conMyData.Open()

result = cmdSelect.ExecuteReader()

rptresult.DataSource = result

rptresult.DataBind()

result.Close()

conMyData.Close()

 

This part of the code works from here on. I have tried both stored procedure and added the (select statement) in the page code! 

 

conMyData =
New SqlConnection(ApplacationUtilities.Epic_Computer_Common.AppUtilities.GetAppSetting("ConnString"))

cmdSelect = New SqlCommand("Select first_name From customers Where account_number=@account_number", conMyData)

cmdSelect.Parameters.AddWithValue("@account_number", dropCustomer.Text)

conMyData.Open()

lblfirst_name.Text = cmdSelect.ExecuteScalar()

conMyData.Close()

conMyData =
New SqlConnection(ApplacationUtilities.Epic_Computer_Common.AppUtilities.GetAppSetting("ConnString"))

cmdSelect = New SqlCommand("Select last_name From customers Where account_number=@account_number", conMyData)

cmdSelect.Parameters.AddWithValue("@account_number", dropCustomer.Text)

conMyData.Open()

lbllast_name.Text = cmdSelect.ExecuteScalar()

conMyData.Close()

conMyData =
New SqlConnection(ApplacationUtilities.Epic_Computer_Common.AppUtilities.GetAppSetting("ConnString"))

cmdSelect = New SqlCommand("Select address From customers Where account_number=@account_number", conMyData)

cmdSelect.Parameters.AddWithValue("@account_number", dropCustomer.Text)

conMyData.Open()

lbladdress.Text = cmdSelect.ExecuteScalar()

conMyData.Close()

 

conMyData =
New SqlConnection(ApplacationUtilities.Epic_Computer_Common.AppUtilities.GetAppSetting("ConnString"))

cmdSelect = New SqlCommand("Select city From customers Where account_number=@account_number", conMyData)

cmdSelect.Parameters.AddWithValue("@account_number", dropCustomer.Text)

conMyData.Open()

lblcity.Text = cmdSelect.ExecuteScalar()

conMyData.Close()

conMyData =
New SqlConnection(ApplacationUtilities.Epic_Computer_Common.AppUtilities.GetAppSetting("ConnString"))

cmdSelect = New SqlCommand("Select state From customers Where account_number=@account_number", conMyData)

cmdSelect.Parameters.AddWithValue("@account_number", dropCustomer.Text)

conMyData.Open()

lblstate.Text = cmdSelect.ExecuteScalar()

conMyData.Close()

conMyData =
New SqlConnection(ApplacationUtilities.Epic_Computer_Common.AppUtilities.GetAppSetting("ConnString"))

cmdSelect = New SqlCommand("Select zip_code From customers Where account_number=@account_number", conMyData)

cmdSelect.Parameters.AddWithValue("@account_number", dropCustomer.Text)

conMyData.Open()

lblzip.Text = cmdSelect.ExecuteScalar()

conMyData.Close()

conMyData =
New SqlConnection(ApplacationUtilities.Epic_Computer_Common.AppUtilities.GetAppSetting("ConnString"))

cmdSelect = New SqlCommand("Select h_phone From customers Where account_number=@account_number", conMyData)

cmdSelect.Parameters.AddWithValue("@account_number", dropCustomer.Text)

conMyData.Open()

lblphone1.Text = cmdSelect.ExecuteScalar()

conMyData.Close()

 

conMyData =
New SqlConnection(ApplacationUtilities.Epic_Computer_Common.AppUtilities.GetAppSetting("ConnString"))

cmdSelect = New SqlCommand("Select b_phone From customers Where account_number=@account_number", conMyData)

cmdSelect.Parameters.AddWithValue("@account_number", dropCustomer.Text)

conMyData.Open()

lblphone2.Text = cmdSelect.ExecuteScalar()

conMyData.Close()

End Sub

</script>

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

<head id="Head1" runat="server">

<link href="StyleSheet.css" rel="stylesheet" type="text/css" />

<title>Admin - Customer Details</title>

</head>

<body>

<form id="form1" runat="server">

<div>

 

<uc1:_Header ID="_Header1" runat="server" />

 

</div>

<div id="menu_top">

<asp:Menu ID="Menu1" runat="server" BackColor="#C8C8C8"

DynamicHorizontalOffset="2" Font-Names="Comic Sans MS" Font-Size="1.1em"

ForeColor="black" Orientation="Horizontal" StaticSubMenuIndent="10px">

<StaticSelectedStyle BackColor="#C8C8C8" />

<StaticMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />

<DynamicHoverStyle BackColor="white" ForeColor="black" />

<DynamicMenuStyle BackColor="#C8C8C8" />

<DynamicSelectedStyle BackColor="#E6E6E6" />

<DynamicMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />

<StaticHoverStyle BackColor="#E6E6E6" ForeColor="black" />

<Items>

<asp:MenuItem NavigateUrl="~/Default.aspx" Text="Home" Value="Home"></asp:MenuItem>

<asp:MenuItem Text="Sales" Value="Customers">

<asp:MenuItem Text="Invoice" Value="Invoice" NavigateUrl="~/Sales/Invoice.aspx"></asp:MenuItem>

<asp:MenuItem Text="Customer Details" Value="Customer Details" NavigateUrl="~/Sales/Customer_Details.aspx"></asp:MenuItem>

</asp:MenuItem>

<asp:MenuItem Text="Business Management" Value="Business Management">

<asp:MenuItem Text="Chart of Accounts" Value="Chart of Accounts" NavigateUrl="~/Business_Management/Chart_of_Accounts.aspx"></asp:MenuItem>

<asp:MenuItem Text="General Ledger" Value="General Ledger" NavigateUrl="~/Business_Management/General_Leger.aspx"></asp:MenuItem>

<asp:MenuItem Text="Inventory Add and Remove" Value="Inventory Add and Remove" NavigateUrl="~/Business_Management/Inventory_Add_Remove.aspx"></asp:MenuItem>

<asp:MenuItem Text="Inventory Edit" Value="Inventory Edit" NavigateUrl="~/Business_Management/Inventory_Edit.aspx"></asp:MenuItem>

<asp:MenuItem Text="Specification Management" Value="Specification Management" NavigateUrl="~/Business_Management/Specification_Management.aspx"></asp:MenuItem>

<asp:MenuItem Text="Service Management" Value="Service Management" NavigateUrl="~/Business_Management/Service_Management.aspx"></asp:MenuItem>

<asp:MenuItem Text="Tax Inforamation" Value="Tax Inforamation" NavigateUrl="~/Business_Management/Tax_Information.aspx"></asp:MenuItem>

<asp:MenuItem Text="Main Page Content" Value="Main Page Content" NavigateUrl="~/Business_Management/Main_Page.aspx"></asp:MenuItem>

<asp:MenuItem Text="Site Categories" Value="Site Categories" NavigateUrl="~/Business_Management/Site_Categorys.aspx"></asp:MenuItem>

</asp:MenuItem>

<asp:MenuItem Text="Employee Management" Value="Employee Management">

<asp:MenuItem Text="Add Employee" Value="Add Employee" NavigateUrl="~/Employee_Management/Employee_Add.aspx"></asp:MenuItem>

<asp:MenuItem Text="Edit Employee" Value="Edit Employee" NavigateUrl="~/Employee_Management/Employee_Edit.aspx"></asp:MenuItem>

<asp:MenuItem Text="Change Password" Value="Change Password" NavigateUrl="~/Employee_Management/Employee_Password.aspx"></asp:MenuItem>

</asp:MenuItem>

<asp:MenuItem Text="Customer Management" Value="Customer Management">

<asp:MenuItem Text="Add Customer" Value="Add Customer" NavigateUrl="~/Customer_Management/Customer_Add.aspx"></asp:MenuItem>

<asp:MenuItem Text="Edit Customer" Value="Edit Customer" NavigateUrl="~/Customer_Management/Customer_Edit.aspx"></asp:MenuItem>

<asp:MenuItem Text="Add Customer Visit" Value="Add Customer Visit" NavigateUrl="~/Customer_Management/Customer_Visit_Add.aspx"></asp:MenuItem>

<asp:MenuItem Text="Edit Customer Visit" Value="Edit Customer Visit" NavigateUrl="~/Customer_Management/Customer_Visit_Edit.aspx"></asp:MenuItem>

<asp:MenuItem Text="Change Password" Value="Change Password" NavigateUrl="~/Customer_Management/Customer_Password.aspx"></asp:MenuItem>

</asp:MenuItem>

<asp:MenuItem Text="Client Section" Value="Client Section">

<asp:MenuItem Text="News" Value="News" NavigateUrl="~/Client_Section/Client_News.aspx"></asp:MenuItem>

<asp:MenuItem Text="Q and A" Value="Q and A" NavigateUrl="~/Client_Section/Client_QA.aspx"></asp:MenuItem>

<asp:MenuItem Text="Virus" Value="Virus" NavigateUrl="~/Client_Section/Client_Virus.aspx"></asp:MenuItem>

</asp:MenuItem>

<asp:MenuItem Text="Web Application" Value="Web Application">

<asp:MenuItem Text="Processing" Value="Processing"></asp:MenuItem>

</asp:MenuItem>

</Items>

</asp:Menu>

 

 

</div>

<div id="master_Content">

<div id="master_contentheader">Customer Details</div>

<div id="master_contentplaceholder">

<center><table cellpadding="2" width="500">

<tr valign="top">

<td>

<center><table>

<tr>

<td>

<font size="2" face="Comic Sans MS">Customer User Name</font><br />

<asp:DropDownList ID="dropCustomer" Runat="server" /><asp:Button ID="Look_up" Text="Look Up!" OnClick="Button_Lookup" Runat="Server" />

</td>

</tr>

</table></center>

<center><font face="Comic Sans MS"><b>Contact Information</b></font></center>

<center><table width="400">

<tr>

<td>

<asp:Label ID="lblfirst_name" EnableState="Falue" Runat="Server" />

<asp:Label ID="lbllast_name" EnableState="Falue" Runat="Server" />

<br />

<asp:Label ID="lbladdress" EnableState="Falue" Runat="Server" />

<br />

<asp:Label ID="lblcity" EnableState="Falue" Runat="Server" />,

<asp:Label ID="lblstate" EnableState="Falue" Runat="Server" />

<asp:Label ID="lblzip" EnableState="Falue" Runat="Server" />

</td>

<td>

Home Phone: <asp:Label ID="lblphone1" EnableState="Falue" Runat="Server" />

<br />

Business Phone: <asp:Label ID="lblphone2" EnableState="Falue" Runat="Server" />

</td>

</tr>

</table></center>

<br />

<center><font face="Comic Sans MS"><b>Customer Visits</b></font></center>

<table width="500">

<tr>

<td width="100"><b>Service Date</b></td>

<td width="75"><b>Tech</b></td>

<td width="75"><b>Invoice #</b></td>

<td><b>Comments</b></td>

</tr>

</table>

<asp:Repeater ID="rptresult" Runat="Server">

<ItemTemplate>

<table border="0" width="500">

<tr>

<td width="100"><%#Container.DataItem("Apointment_date")%></td>

<td width="75"><%#Container.DataItem("Tech")%></td>

<td width="75"><%# Container.DataItem("Invoice_num") %></td>

<td><%# Container.DataItem("Comments") %></td>

</tr>

</table>

</ItemTemplate>

</asp:Repeater>

</td>

</tr>

</table></center>

</div>

</div>

</form>

</body>

</html>


discussion1:

 Hey this is something to do with Code Access Security.

I suggest you but a breakpoint in your code and step through it to find which line is being naughty

discussion2:

ok how do you

 

rtpHarry:


play audio in web page

Question:
Hi all I m working on a website which will allow users to upload audio file in any format to make their collection. This website will play those audios for user whenever they want. i don't know how do I accomplish this task I have some confusions 1. Should I store the uploaded file in their original formats in my host server OR convert them to one specific format(ex. mp3 or wav) and then play with that format only 2. also i don't know how to play audio in web page Any suggestions, Ideas, Links would be most appreciable Thank you.

discussion1:

I'd suggest that you start by only allowing mp3 files. It's fairly standard and will be much simpler to get started on. As for playing the files, I use http://www.macloo.com/examples/audio_player/ you can see what i've done here: http://www.jacquelinewhite.co.uk/classical-mp3-recordings.html

HTH's


discussion2:

UjjwalMeshram:

discussion3:

 

Here a way using client side..

<object height="50%" width="50%" classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95">

<param name="AutoStart" value="1" />

<param name="FileName" value="D:\\Songs\\test.mp3" />

</object>

 

 


discussion4:
That exactly what I wanted. Many thanks to you sir


Need help getting information from RadioButton control...

Question:

Hi, 

Please see my code below.  How can I set the selectedFeeID value (line 11)?  The value comes from an asp:RadioButton control (line 139).  The code as written give an error at line 11 stating "object reference not set to an instance of an object.  The complication comes from the layers of controls I've nested in the web form.  The nesting looks like this:

1.  ListView1 (lvCourseListing)

  2. ListView2 (lvCourseSections)

          LinkButton (lbAddToCart) -- This causes lbAddToCart_Click to fire, which runs the code below.

    3. ListView3 (lvCourseFeesGroup)

           RadioButton (rdoEnrollmentOptions) -- This has the value I'm trying to set.

1        protected void lbAddToCart_Click(object sender, CommandEventArgs e)  2        {  3            int sectionID = Convert.ToInt32(e.CommandArgument);  4            int webSiteNumber = Convert.ToInt32(WebConfigurationManager.AppSettings["WebSiteNumber"]);  5            int visitorID = Convert.ToInt32(Session["visitor_id"]);  6            string sessionID = Session.SessionID.ToString();  7      8            // Set selected fee ID based on the selected radio button.  9            int selectedFeeID;  10           RadioButton rdoEnrollmentOption = (RadioButton)this.FindControl("rdoEnrollmentOption");  11           selectedFeeID = Convert.ToInt32(rdoEnrollmentOption.Text.ToString());  // Error: Object reference not set to an instance of an object.  12     13           string _conString = null;  14           SqlConnection _con = null;  15           SqlCommand _cmdSelect = null;  16           _conString = WebConfigurationManager.ConnectionStrings["ConnectionString1"].ConnectionString;  17           _con = new SqlConnection(_conString);  18           _cmdSelect = new SqlCommand("web_reg_shopcart_add", _con);  19           _cmdSelect.CommandType = CommandType.StoredProcedure;  20           _cmdSelect.Parameters.Add("@web_site_number", SqlDbType.Int).Value = webSiteNumber;  21           _cmdSelect.Parameters.Add("@visitor_id", SqlDbType.Int).Value = visitorID;  22           _cmdSelect.Parameters.Add("@session_id", SqlDbType.VarChar, 32).Value = sessionID;  23           _cmdSelect.Parameters.Add("@section_id", SqlDbType.Int).Value = sectionID;  24           _cmdSelect.Parameters.Add("@selected_fee_id", SqlDbType.Int).Value = selectedFeeID;  25           _cmdSelect.Parameters.Add("@num_breakouts", SqlDbType.Int);  26           _cmdSelect.Parameters["@num_breakouts"].Direction = ParameterDirection.Output;  27           _cmdSelect.Parameters.Add("@error_code", SqlDbType.Int);  28           _cmdSelect.Parameters["@error_code"].Direction = ParameterDirection.Output;  29           _cmdSelect.Parameters.Add("@message_text", SqlDbType.VarChar, 4000);  30           _cmdSelect.Parameters["@message_text"].Direction = ParameterDirection.Output;  31     32           int numBreakouts = 0;  33           int errorCode = 0;  34           string messageText = "";  35     36           try  37           {  38               _con.Open();  39               _cmdSelect.ExecuteNonQuery();  40               if (!_cmdSelect.Parameters["@num_breakouts"].Equals(System.DBNull.Value))  41                   numBreakouts = (int)_cmdSelect.Parameters["@num_breakouts"].Value;  42               if (!_cmdSelect.Parameters["@error_code"].Equals(System.DBNull.Value))  43                   errorCode = (int)_cmdSelect.Parameters["@error_code"].Value;  44           }  45           finally  46           {  47               _con.Close();  48           }  49           if (errorCode > 0)  50           {  51               Response.Redirect("EditShopcart.aspx");  52           }  53           else  54           {  55               lblErrorMessage.Text = messageText + " (Error Code: " + errorCode + ")";  56           }  57       }  58     59   "Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">  60     61       "lvCourseListing" runat="server"  62                     DataSourceID="sdsCourseListing"   63                     OnItemDataBound="lvCourseListing_ItemDataBound"   64                     DataKeyNames="master_version" >  65             66               
class="datalabel"> 67 "lblCourseListingEmpty" runat="server" Text="Unable to retrieve information on the selected program."> 68

discussion1:

the error is caused as it could not find the radio button u specified in the findcontrol

 RadioButton rdoEnrollmentOption = (RadioButton)this.FindControl("rdoEnrollmentOption");
11           selectedFeeID = Convert.ToInt32(rdoEnrollmentOption.Text.ToString()); 

 

r u using contentplaceholder for u r page,if so u can use this code

contentplaceholder mcon=new contentplaceholder();

mcon=(contentplaceholder)master.findcontrol("contentplaceholder1");

Radiobutton rdoEnrollmentOption =(RadioButton)mcon.findcontrol("rdoEnrollmentOption ");


discussion2:

 Try this

  selectedFeeID = (int)rdoEnrollmentOption.Text;
or 
  selectedFeeID = Convert.ToInt32(rdoEnrollmentOption.Text); 

 


discussion3:

hi,

if you are using radibuttonlist then use

rd.SelectedItem.Value


discussion4:

To naveen.gummudu:

Thanks for your response.  Unfortunately, I have the same problem using <asp:RadioButtonList> as I have using <asp:RadioButton>.  When I try to reference it in the code-behind using the syntax you suggested, I get the run-time error:  "Object reference not set to an instance of an object."

The "view source" for the RadioButtonList appears as follows:

<tr>  <td><input id="ctl00_ContentPlaceHolder1_lvCourseListing_ctrl0_lvCourseSections_ctrl0_rblCourseFeesGroup_0" type="radio" name="ctl00$ContentPlaceHolder1$lvCourseListing$ctrl0$lvCourseSections$ctrl0$rblCourseFeesGroup" value="44877" /><label for="ctl00_ContentPlaceHolder1_lvCourseListing_ctrl0_lvCourseSections_ctrl0_rblCourseFeesGroup_0">Text Book (New)</label></td>  </tr><tr>  <td><input id="ctl00_ContentPlaceHolder1_lvCourseListing_ctrl0_lvCourseSections_ctrl0_rblCourseFeesGroup_1" type="radio" name="ctl00$ContentPlaceHolder1$lvCourseListing$ctrl0$lvCourseSections$ctrl0$rblCourseFeesGroup" value="44876" /><label for="ctl00_ContentPlaceHolder1_lvCourseListing_ctrl0_lvCourseSections_ctrl0_rblCourseFeesGroup_1">Text Book (Used)</label></td>  </tr>  
Also, there is a secondary problem using RadioButtonList:  I cannot figure out a way to display multiple columns from the DataSource.  It seems that I can only specify a single column for the DataTextField attribute.  I would like to have multiple columns so I could display the radio button, followed by item name, item stock #, item price, etc.

I'd welcome any further ideas you might have.  Thanks.


discussion5:

To venkatu2005:  Thanks for your reply.  Unfortunately, neither way seems to work.  The control (rdoEnrollmentOption) still appears to be unavailable to the code-behind.  Here are the errors I get for each:

selectedFeeID = (int)rdoEnrollmentOption.Text;  // Compilation Error:  CS0030: Cannot convert type 'string' to 'int'

selectedFeeID = Convert.ToInt32(rdoEnrollmentOption.Text);   // Runtime Error:  Object reference not set to an instance of an object.

Thanks...


discussion6:

To greeny_1984:  Thanks for your reply.  I am using ContentPlaceHolder for my page, and I tried your suggestion.  Unfortunately, I get the same error on the same line:

selectedFeeID = Convert.ToInt32(rdoEnrollmentOption.Text.ToString());  // Runtime Error: Object reference not set to an instance of an object.

I've pasted the "view source" of the radio buttons below.  As you can see, the input id's show the hierarchy of controls, which does include the ContentPlaceHolder1. 

<span class="tabledata-hidetext"><input id="ctl00_ContentPlaceHolder1_lvCourseListing_ctrl0_lvCourseSections_ctrl0_lvCourseFeesGroup_ctrl0_rdoEnrollmentOption" type="radio" name="ctl00$ContentPlaceHolder1$lvCourseListing$ctrl0$lvCourseSections$ctrl0$lvCourseFeesGroup$ctrl0$rdoEnrollmentOptions" value="rdoEnrollmentOption" /><label for="ctl00_ContentPlaceHolder1_lvCourseListing_ctrl0_lvCourseSections_ctrl0_lvCourseFeesGroup_ctrl0_rdoEnrollmentOption">44877</label></span>
<span id="ctl00_ContentPlaceHolder1_lvCourseListing_ctrl0_lvCourseSections_ctrl0_lvCourseFeesGroup_ctrl0_lblName">Text Book (New)</span>
<div class="right">
   <span id="ctl00_ContentPlaceHolder1_lvCourseListing_ctrl0_lvCourseSections_ctrl0_lvCourseFeesGroup_ctrl0_lblAmount">$12.00</span>
</div>
<span class="tabledata-hidetext"><input id="ctl00_ContentPlaceHolder1_lvCourseListing_ctrl0_lvCourseSections_ctrl0_lvCourseFeesGroup_ctrl1_rdoEnrollmentOption" type="radio" name="ctl00$ContentPlaceHolder1$lvCourseListing$ctrl0$lvCourseSections$ctrl0$lvCourseFeesGroup$ctrl1$rdoEnrollmentOptions" value="rdoEnrollmentOption" /><label for="ctl00_ContentPlaceHolder1_lvCourseListing_ctrl0_lvCourseSections_ctrl0_lvCourseFeesGroup_ctrl1_rdoEnrollmentOption">44876</label></span>
<span id="ctl00_ContentPlaceHolder1_lvCourseListing_ctrl0_lvCourseSections_ctrl0_lvCourseFeesGroup_ctrl1_lblName">Text Book (Used)</span>

Would appreciate any additional insight you might have.  Thanks again...


discussion7:

 I think

 The radiobutton you finding by using FindControl and it will

 be assigned to the some integer Variable....the Radiobutton contains NULL value

 so it shows Object reference exception , Check whether radiobutton contains null or some

 value....

 


discussion8:

hi,

i think you are not getting the rblCourrseFeesGroup object

try this

RadioButtonList rd = (RadioButtonList)ContentPlaceHolder1.FindControl("rblCourseFeesGroup");

then use rd object to get the value

i also identified in your id are rendering as lvCourseListing and lvCourseSections, whare are those controls? if above is not working try to find these controls (lvCourse...) then from these controls find your radio button


discussion9:

protected void lbAddToCart_Click(object sender, CommandEventArgs e)
2        {
3            int sectionID = Convert.ToInt32(e.CommandArgument);
4            int webSiteNumber = Convert.ToInt32(WebConfigurationManager.AppSettings["WebSiteNumber"]);
5            int visitorID = Convert.ToInt32(Session["visitor_id"]);
6            string sessionID = Session.SessionID.ToString();
7   
8            // Set selected fee ID based on the selected radio button.
9            int selectedFeeID;
10           RadioButton rdoEnrollmentOption = (RadioButton)this.FindControl("rdoEnrollmentOption");
11           selectedFeeID = Convert.ToInt32(rdoEnrollmentOption.Text.ToString());  // Error: Object reference not set to an instance of an object.
12  

i think i found u r answer

 

u are having radiobuttonlist with two options textbook-new and textbook-old and having values assigned to it ,as i can see from u r view source.

and u are trying to convert the textbook-new value to int and thats y u are getting that error

so check this example 

 <asp:radiobuttonlist id="rdlist" runat="server">

 <asp:listitem value="0">textbook-old</asp:listitem>

<asp:listitem value="1">textbook-new</asp:listitem>

</asp:radiobuttonlist> 

 so in order to get its value u have to use it like this

int val=(int)(rdlist.selectedvalue.tostring());

 

 


discussion10:

I appreciate all of your input.  I'm afraid I may have confused things by introducing the possibility of using the RadioButtonList (instead of the RadioButton, which I prefer to use becuase it gives me more options for layout).  In any case, I've tried your suggestions without any success. 

naveen.gummudu:  You're correct, I am not getting the rblCourseFeesGroup object.  I did try to find the controls within the hierarchy.  ContentPlaceHolder1, lvCourseListing, lvCourseSections, rblCourseFeesGroup.  I find the first two; but the last two are null; i.e., they are not found.  Consequently, when I try to get the SelectedValue from the RadioButtonList, I get the runtime error stating "Object reference not set to an instance of an object."

        ContentPlaceHolder ContentPlaceHolder1 = (ContentPlaceHolder)Master.FindControl("ContentPlaceHolder1");
        ListView lvCourseListing = (ListView)ContentPlaceHolder1.FindControl("lvCourseListing");
        ListView lvCourseSections = (ListView)lvCourseListing.FindControl("lvCourseSections");
        RadioButtonList rblCourseFeesGroup = (RadioButtonList)lvCourseListing.FindControl("rblCourseFeesGroup");
 


discussion11:

can u show us u r design view


discussion12:

ckc:


user control and events

Question:

Hello,

I have a user control which i use througout the site.  The user control is just a form with a textbox and a button.  On pressing the button i want to goto another page and populate it with the contents of the textbox.  How do I do this?  I know I can store the value in a session then redirect to the page but i was hoping of using some delegate events or something.  does anyone know a godo solution without using sessions?

 

thanks for your advice


discussion1:

Hi,
You can try using query string if the data in the textbox isn't confidential.
The only thing you have to do in that case is to add the query string to the url of the page you want to redirect to and in that page to retrieve the data from the query string.
Read the following post I wrote in the subject:
ASP.NET Client Side State Management - Query Strings



RegularExpressionValidator

Question:

Hi guys can any one tell me why my application is breaking.Below is my code:

<asp:TextBox ID="txtcutNo" runat="server" />
                    <asp:RegularExpressionValidator ID="valcustnum" runat="server"
                            ControlToValidate="txtcutNo"
                            ValidationExpression="^\d{6}$"
                            ErrorMessage="Invalid Entry, Midas Number is a six degits numeric number."
                            Display="dynamic">*
                            </asp:RegularExpressionValidator>

 

This textbox is intended to only allow 6 numeric degits. buy when i enter a number like 333333 it breaks. 


discussion1:

Could you explain how you mean by "breaks"?

Do you get an exception or it just wont let the validation through or what?

 

 Fyi its spelled Digits not Degits.


discussion2:

 I think I know what the problem is...I'm kinda new in programming...I only breaks if the value does not exist in my database. I think I should place my validation in my database.

Below is the exception it throws:

Argument out of Range Exception:

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


discussion3:

 I think I know what the problem is...I'm kinda new in programming...I only breaks if the value does not exist in my database. I think I should place my validation in my database.

Below is the exception it throws:

Argument out of Range Exception:

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


discussion4:

I finally figured it out...I was not using good programming concepts...I was not catching the exception. hence it would break every time I put an invalid midas number.

try

{

 //code to get the midas number here.

}

catch(Exception ex)

{

MessageBox.Show(ex.Message) or (MessageBox.Show("Midas Number does Not Exist")

}