Based on the code, it looks like a dropdownlist does exists from before. In the RowDataBound event you are trying to populate data in that pre-existing dropdown. Since, it pre-exists, you can define a selected change index for it.
In case you want to define it at runtime in RowDataBound, then you need to add this:
AddHandler ddlFilter.SelectedIndexChanged, AddressOfMe.ddl2_SelectedIndexChanged
ddlFilter.AutoPostBack = truePrivateSub ddlFilter_SelectedIndexChanged(ByVal sender AsObject, ByVal e As EventArgs)
'your code EndSub
This is a forum where people post their issues in form of specific question and others try to help in resolving it.
Based on what you have posted, surely it is not a question. I did not clicked the link as it looked malicious.
Please don't post information messages in this forum. If you have specific question, you are most welcome.
In case you want to share anything with others (some tutorial stuff), please post the content here at CP as a Tip/Article[^] and it will be published post approval.
Hi all I am trying learn how to create and access session variables inside and out side of pageload. I've found that I can create a session variable inside of the pageload method like the following:
int myID = 0;
Session["UserID"] = RetrievedID;
Then I can access the session variable in the pageload method of another page like the following:
int myID = (int)Session["UserID"];
Some questions I have are do I need to use Response.Redirect() method to successfully send session variables to another page, and how do I create and access session variables outside of the pageload method. Thanks in advance.
do I need to use Response.Redirect() method to successfully send session variables to another page
how do I create and access session variables outside of the pageload method.
similarly as you did now.
Now, overall, you need to understand the concept of Session. First and foremost, it is not page level, it is across the application per user level. For a given user, a session can be created in any page and accessed in any page.
No.U dnt need to use it.Because sessions willbe created in web server so whenever you want to access it from any page you can simply access it by using session["sessionid"] collection object....Thank you!
So, this is probably something I should know how to do anyway but don't... sadly.
I would like to take a project I found here, specifically: http://www.codeproject.com/Articles/460142/ASP-NET-Multiple-File-Upload-With-Drag-Drop-and-Pr and turn it into a control that I can use on an existing website (after changing the save directory and such of course) in the same way I would drop in, say, CKEditor... drop the DLL's in the Bin directory, register it on the page and then lob in a little, <mfu:mfuUpload ID="somesuch" runat="server" /> magic.
So, how would I go about doing that?
For the record, I'm not as lame as this question implies, there're just giant holes in an otherwise brilliant mind.
Can anybody help me with requirement. i have a requirement that an .aspx page will contain a static text box and a static button(GENERATE). user will enter number in the textbox say four(4) and click the GENERATE Button,then 4(four) dropdownlist and a button(ADD) will be dynamically created. The dropdown list will contain data like first(1) dropdown will contain value 1,2,3,4...10 and second dropdown will contain 10,11,12....20 and so on. On Clicking the dynamically created ADD button the values of the dynamic dropdowns will be summed and shown in another label that will be dynamically created of the dynamically created ADD button click event.
Thanking you. Any kind Of Help is earnestly solicited.
1. Define a GENERATE Button click handler X
2. In X, get the number provided in Textbox (say y)
3. Define a counter(say z). Set it to one.
4. Code a for loop from zero to y-1 (loop runs y times)
5. Create a dropdownlist inside the loop using new.
Define a datasource - a list
Populate list with fixed 10 numbers starting from z. for first loop z goes from 1 to 10, next 11-20...
Bind the datasource to dropdonw
Add the dropdown to the defined panel/placeholder in UI
6. Once for loop ends, create a button (A), define click event and add that too the defined panel/placeholder in UI.
7. for click event of A, do your manipulations as per need.
I am trying to build a total image from a series of png files chosen by the user by checkboxes. This will be displayed on a website. I have already successfully done this by using CSS and z indexing for layer heights but now it has been suggested to me to use the bitstream method to compile and display the final picture.
Can anyone tell me which of these methods (css or bitstream) is the most efficient for speed and server resources on the web?
Thanks in advance
You can run your website in both .Net framework 3.5 and 4.0. While opening the website in .Net 4.0, you'll be ask to update your website. Depends upon you, whether you want to update the website or continue using 3.5 only.
I have a textbox(textarea) in which one can write source code in any programming languages, but the problem is that when TAb key pressed instead of giving blank space it gets out from the textbox and move to next element.... So my requirement is that when TAB key is pressed it will give blank space.
Thanks in advance,Any help will be appreciated...!!!
i have a very specific need for my new project and even logical explanation will do the job . I want to show repeated gridview data in a column with seperated commas and i am also using onrowcreated and rowdatabound methods for multiple headers of gridview from this example:
Hi, thanks for replying. I still have one question about the Eval expression. What happens when the hyperlink is clicked due to the fact that the ID' field of the datasource is bounded to the text property of the hyperlink? Is the ID sent to the Default.aspx page when the hyperlink is clicked? Thanks in advance for your reply.
My problem is i am binding around 8,000 records in the gridview and the problem is it is taking more than a min to display data onto the browser. I know one solution can be to use Paging but client does not want paging as he has to search something in grid using ctrl + F feature of the browser. My question is can i load data in a gird view asynchronously just to make the reterieving of data somewhat faster or like as i scroll down in the grid it fetches next set of records without freezing the screen. I have seen this type of feature applied in various E-Commerce sites.
It is really surprising to see your client's requirements. However I even agree to the fact that requirements will always be wierd from a developer point of view. It is anyways a bad idea to show all the records at once. What would you do if the number of records increase to 20K or to 1 million? I would suggest you convince your client, get the paging implemented for the gridview. Another option would be, give a search functionality in the page. Based on the search criteria load the relevant records.
Look at the following links, all of them suggest to use paging. Second link talks about some Telerik control, which loads records on demand by scroll. You can check it out. Loading records in the grid view while scrolling down,No Paging technique.[^] displaying-large-gridviews-efficienty-in-asp-net[^]
as the above answer suggest giving all data at once is not a good practice , why not convince your client to use search from gridview (you can provide search box above gridview) IMHO you should convince him/her for that because as the records will increase the performance of your project will go down with time no matter what you use (Async or not) because even browser apps take space in memory and soon with so much data if its not a good system, the browser will start crashing(Personal experience)
sometimes noobs perform better but its sheer luck...
Hi all, if I bind my datatable which contains the path of a file or files in a folder on the web server, to a gridview like the following, I will get a gridview with file paths inside of it.
DataTable myTable = new DataTable("myData");
string fileEntries = Directory.GetFiles(Server.MapPath("~/Uploads/"));
int linkL = 0;
foreach (string fileName in fileEntries)
myTable.Rows.Add("~/Uploads/" + Path.GetFileName(fileName));
myGrid.DataSource = myTable;
As it stands, the code snippet above successfully allows users to download a file by clicking on its path inside of the URL Column of the Gridview. So basically if the file from the web folder is Test.txt I would see the following path in the URL column:
But what if I want to change the name Test.txt to a different name and still be able to download the fie? I have tried to change Test.txt to something else by inserting a new name in the path but I get an error message saying that the new file is not found. Any suggestions will be greatly appreciated, thanks for your help.
I have an ASP.net\AJAX 4.0 forms application that is having a performance issue. The app is hosted on go daddy shared hosting servers. Intermittently (about half the time) a page request hangs for a significant amount of time. I have run lots of tracing on it and found that the hangup is happening before the request even gets to the server. I have setup ASP.net tracing to spit out a timestamp gathered during the application.begin_request event. An example of a typical scenario I am observing is that I request a page at 00 seconds and get the response at 30 seconds. ASP.net tracing tells me that application.begin_request (via the timestamp) started at 27 seconds and the entire page cycle took less than 3 seconds to complete.
I also traced with the Internet Explorer 9 F12 debug feature and if I look at the timings tab (in detail view) I observe that all of the hangup time is occuring in what Internet Explorer is calling the "Start" event - the description is "The time from when the request was initially created to when the request is sent".
So my question is, does anybody know what would cause requests to intermittently get held up in the browser like that? It does not happen in development (only from hosted site) and occurs from multiple types of browsers and multiple PCs - so it is not isolated to a particular browser environment.
Those are good reads as I was not familiar with that but unfortunately to use those would require a lot of code re-writing. I am confident that this latency is not from AJAX. I have run tracing in fiddler, dynaTrace, and IE and in all cases the tools report a responsive site in all ways other that this strange random latency in the pre-request state. I really need to simply identify what is going on during the browser start\wait period on the random page requests that experience latency. However it seems that there is no information about anyone having a similar situation anywhere on the web.
I have WCF ServiceA and WCF ServiceB. ServiceA is calling ServiceB. Both of them are using BasicHttp binding. But I am getting the exception with message as below. When I am trying to call the ServiceA and ServiceB individually from a test page both of them are working fine.
But I want to call ServiceB from ServiceA. I am not using the ServiceReference to call the serviceB I am calling the Service in the following way
Code to create the Service proxy
PublicClass ServiceFactory(Of T)
PublicSharedFunction GetBasicHttpChannelForService(ByVal source AsString) As ChannelFactory(Of T)
Dim factory As ChannelFactory
Dim result = String.Empty
Try'Get the channel from WCFDim address As EndpointAddress = New EndpointAddress(source)
Dim binding As BasicHttpBinding = New BasicHttpBinding()
binding.MaxReceivedMessageSize = 2147483647
binding.ReaderQuotas.MaxArrayLength = 2147483647
binding.MaxBufferPoolSize = 2147483647
binding.CloseTimeout = New System.TimeSpan(1, 1, 1)
binding.OpenTimeout = New System.TimeSpan(1, 1, 1)
binding.ReceiveTimeout = New System.TimeSpan(1, 1, 1)
binding.SendTimeout = New System.TimeSpan(1, 1, 1)
If factory IsNothingThen
factory = New ChannelFactory(Of T)(binding, address)
ElseIf factory.State = CommunicationState.Closed Then
factory = New ChannelFactory(Of T)(binding, address)
ElseIf factory.State = CommunicationState.Faulted Then
factory = New ChannelFactory(Of T)(binding, address)
ElseIfNot factory.State = CommunicationState.Opened Then
factory = New ChannelFactory(Of T)(binding, address)
EndIfCatch ex As Exception
EndFunctionPublicSharedSub CloseChannelFactory(ByRef factory As ChannelFactory)
IfNot factory IsNothingThenIf factory.State <> CommunicationState.Closed Then
factory = NothingEndIfEndSubEndClassAndin the test page's load even I am creating the Service proxy in the following wayProtectedSub Page_Load(ByVal sender AsObject, ByVal e As System.EventArgs) HandlesMe.Load
Dim factory As ChannelFactory(Of IStayAtWorkService)
'GetMessages(New Guid("b14bc077-f1df-457c-9f7e-7cb9e0bc1cf3"))'Dim factory As ChannelFactory(Of IStayAtWorkService)Try
factory = ServiceFactory(Of IStayAtWorkService).GetBasicHttpChannelForService _
Dim sawService As IStayAtWorkService = factory.CreateChannel()
Dim inputFileBytes() AsByteDim inputFile AsString = ConfigurationManager.AppSettings("InputFiles")
Using fstream = New FileStream(inputFile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)
Using br As BinaryReader = New BinaryReader(fstream)
inputFileBytes = br.ReadBytes(fstream.Length)
EndUsingDim fUpload AsNew RequestFile()
fUpload.FileName = inputFile
fUpload.FromDiv = "Accordian1"
fUpload.ImageBytes = inputFileBytes
fUpload.RequestId = 2Dim d = sawService.SaveRequestFile(fUpload)
GridView1.DataSource = d
Catch ex As Exception
Where am I missing, doesnt WCF support calling one service from another service or is it because I am creating service client for serviceB by using runtime mechanism. Please give me some solution. I would be really really thankful. When I am able to call individually why am I not able to call one service from another service. Please help me in fixing it. Following is the error message I am getting.
The remote server returned an unexpected respo
nse: (400) Bad Request.
And Stack TRace is :
Server stack trace:
at System.ServiceModel.Channels.HttpChannelUtilities.ValidateRequestReplyResponse(HttpWebRequest request, HttpWebResponse response, HttpChannelFactory factory, WebException responseException, ChannelBinding channelBinding)
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object ins, Object outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object ins, Object outs)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at :
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at WA.LNI.StayatWork.Service.IStayAtWorkService.SaveRequestFile(RequestFile fUpload)
at WA.LNI.StayatWork.Public.UI.WebServiceTestPage.Page_Load(Object sender, EventArgs e) in D:\source\SourceCode\StayatWork-VS2010\WA.LNI.StayatWork.Public.UI\WebServiceTestPage.aspx.vb:line 157
I have a C# 2010 web application that is having problems displaying a few items from the master pages. Thus I need to be able to determine what the issue. Due to that fact, I have the following questions:
1. F12 Developer Tools look like they can be used to analyze what a problem is. Can you tell me where I can obtain a copy of the F12 Developer Tools? Are the part of Visual Studio.net 2010 professional edition? If so, can you tell me what part of the install I would obtain the F12 developer tool from?
2. If the F12 Developer Tools are not part of visual studio, can you tell me where I can download the tool from?
3. Do you have directions I can follow on how to use this tool?
I am binding MSChart to a dataset filled with 2 or more datatables. The MsChart is showing only the last datatable. My code is pasted below:
Private Sub ProductionChart()
'use collection to collect Selected product
Dim Col As New Collection
For Each lst As ListItem In chkWStringList.Items
If lst.Selected Then
oDs = New DataSet
oDs = oTier.Production3(Col, Date.Parse(Date1.Text), Date.Parse(Date2.Text))
'Create new chart area for original series
Dim ca As ChartArea = .ChartAreas.Add("ca2")
.Titles(0).Text = "Chart"
.Titles(0).Font = New Font("Trebuchet", 14, FontStyle.Bold)
.ChartAreas("ca2").AxisX.TitleFont = New Font("Verdana", 10, FontStyle.Bold)
You get the last datatable as you have written code for that. You have started a for loop and keep changing the datasource depending on the index 'j'. Finally, when the loop comes to an end, 'j-1' has the last table pointed as a reference to datasource leading to data display of last table.