Yes. We can create CSV file instead of XLS. But, there's only one thing that could be a little bit undesired - wizard that opens CSV file. I'm not sure, but I think MS Excel cannot open CSV file directly without using wizard. Is that right?
Tesic Goran
Posts
-
How to create MX Excel file from DataTable? -
How to create MX Excel file from DataTable?Hi, I need to create MS Excel file from DataTable in ASP.NET application. I don't need "SaveAs" dialog. Just create a file and save them to some folder. I've searched the internet and found some examples how to do that by using Microsoft Excel Interop library. But, I can't use Excel Interop library. Is there any other way to do it? Thank you in advance. Goran
-
JavaScript: How to reference user control inside content page?Hi, I use ASP.NET. This is structure I have: Master page -> Content page -> User control -> Telerik grid with its context menu, hidden field. This means: Master page contains content page, content page contains user control, user control contains Telerik grid with its context menu and hidden field. I open popup window by clicking option in Telerik grid's context menu. After I choose some option in combo box in that popup window I press OK and close it. But I don't know how to reference opener that should be user control with Telerik grid and hidden field. I want to set hidden field to some value. This is JavaScript code I use:
function ReturnValue() { var choice = document.getElementById("DropDownList1").value; if ((window.opener != null) && (!window.opener.closed)) { window.opener.document.getElementById("HiddenField1").value = choice; } window.close(); }
But, it fails on this line because opener is master page: window.opener.document.getElementById("HiddenField1").value = choice; So, how can I make it work? Thank you in advance.
-
URGENT: Method with WCF service address as parameter?Hi, I have a little bit strange task that never saw so far. The solution contains 2 projects: Project 1: Client application that calls some external WCF service as following:
ExtService client = new ExtService();
// The address of WCF service that I should write in Project 2
string Url = "http://MyHost/Service.svc";
string param1 = "abcd";string content = client.Method1(Url, param1);
Project 2: WCF service that should be at this address:
and it should look as following:
public Message SetData(Message requestXml)
{
// Do something with requestXml, which is actually
// SOAP XML string created in Project 1
}Message is raw SOAP message. As you can see Method1 in Project 1 get the address of my service in Project 2, doing something and getting some SOAP XML string as a result of that operation. I should get that SOAP XML in some way in my WCF service. This is unusual scenario for me and I'm wondering if this is possible to make it work? The key point is how can I get that SOAP XML in my WCF service?
-
WCF: Why to use System.ServiceModel.Channels.Message class?I have a general question. Why sometimes should we use System.ServiceModel.Channels.Message class instead of some concrete class when we create WCF service? For example: 1) We can use the following:
public Person GetPersonById(int id)
{
Person person = Employees.CreateEmployees().First(e => e.Id == id);
return person;
}- But we can use the following as well:
public Message GetPersonById(Message id)
{
string firstName = Employees.CreateEmployees().First(e => e.Id == id.GetBody()).FirstName;
Message response = Message.CreateMessage(id.Version, ReplyAction, firstName);
return response;
}What's the difference? Thank you in advance. Goran
-
Generating and invoking WCF service using WSDL and XSD programmaticallyHi, My situation is following: I have a bunch of XSD files as input only. And I know how WCF service contract should look like: [ServiceContract] public interface ICustomService { [OperationContract] Message CustomAction(Message msg); } Message is SOAP message. I need to create WSDL file based on XSD files. After that I should use that WSDL file and existing XSD files to create WCF service that should be in the form above. The important thing is - everything should be done dynamically (programmatically). It means XSD files should be added to the process of WSDL creation also programmatically, created WSDL file should be used to invoke WCF service also programmatically... So, if someone can write some code as putting me to right direction I'll be more than thankful. Thank you in advance.
-
How to produce SOAP message using XSD and WSDL files?I have XSD and WSDL files as input and should create Soap messages and extract Soap body from them. I know how to do that in VS2008 using code-first approach when I write interfaces and classes and use "Add Service Reference..." option. But, our requirement is not to use all these nice things because we get XSD and WSDL files and should create Soap message in some another way. My colleague tried to use svcutil.exe but he found it made the errors. So, can we do that by using some another tool or programmatically? We use C# and .NET Framework 3.5. Thank you in advance. Goran
-
Restrict object's properties to be added in ASP.NET application stateI have some objects I should add to ASP.NET application state. Of course, I can add the object as a whole. The class that object belongs to have some properties and all of them will be added with the object to the application state. But, is there a way to mark some properties of the class to not be included in adding object to the application state? I've thought about writing attribute, but am not sure if it will work. Thank you for any suggestion.
-
How to change mouse cursor in jQuery UI resizable plugin?When you use jQuery UI resizable plugin the mouse cursor style can be as "e-resize" (2 arrows in opposite directions). But, how can we change it? I've tried this: $("#right-line").hover(function() { $(this).css("cursor", "crosshair"); }); And it doesn't work, that is the cursor is still "e-resize". Actually, I've made my own outer black div around the main div rectangle. That outer black div is like a thin border and has 8 small squares in top-left, top-right, bottom-left, bottom-right corners and top-center, bottom-center, left-center and right-center locations, which I want to use as my own handles. It means I don't want to allow "e-resize" cursor along the whole border of container, but only on my own squares. So, I need to control the cursor style in jQuery UI resizable plugin. I know I can change the original jQuery CSS file, but is there a way to achieve this programmatically? Thank you for any suggestion.
-
How to make the text box draggable using jQuery?Is anybody there who has experience with making html input text box draggable using jQuery? I've tried to wrap text box inside div and can make it resizable, but not draggable. The div and text box are placed on standard jQuery UI dialog. Actually, I need both - draggable and resizable html input text box inside dialog. The code is as follows:
$(document).ready(function() { $("#btnShow").click(function(e) { $('#dialog').dialog("open"); }); $('#dialog').dialog({ title: "Sample dialog", resizable: false, autoOpen: false, width: 400, height: 300, buttons: \[{ text: "OK", click: function() { /\* do something \*/ } }, { text: "Cancel", click: function() { $(this).dialog("close") } }\] }); $('#divText1').draggable({ containment: "parent", cursor: "move" }).resizable({ containment: "parent", handles: "e, w" }); }); <input id="btnShow" type="button" value="Show" /> <input type="text" style="width: 98%;" value="Hello world!" />
Thank you in advance. Goran
-
How to build business layer in MVC3 project?I've already read some articles about this matter, but I'm not sure how to solve my problem. I work on project in which we use MVC3. The project should manage school system (schools, pupils, teachers, parents, users, roles and so on. In the center of such a school management system is - schedule of subjects. We get data from MS SQL Server through EF4 (database first approach), which means all entity classes are created automatically. Therefore, I have such a classes that represent database tables such as School, Pupil, Teacher, Role and so on. And I have DbContext derived class. We primarily know how our presentation (UI) layer should look like. The problem is in layer between UI and classes we got automatically by using EF4 that I've already mentioned. I've read about repository and unit of work patterns and understood how they work. I've thought we could apply those patterns, but our project architect wants to use something else. He wants to have clear separation of layers. He wants to call simple methods from controllers that are placed in business layer, which means almost whole logic should not be in controllers, but in that business layer. I'm not sure now what I should start with. I have all those entity classes School, Pupil, Teacher, Role and so on. And I have DbContext derived class. That means those classes are input for business layer. What should be output of business layer? How could I design business layer? Thank you in advance. Goran
-
MVC3: How to get the text box value as parameter?Hi, I'm new in MVC3 and have a simple question. I have Index.cshtml file (view) with 2 controls text box and hyper link: @Html.TextBox("contId") @Html.ActionLink("Query", "Query") In controller class I'd like to have an action that handles clicking hyper link and getting the value of text box above in order to use it in LINQ construction as follows:
public ActionResult Query()
{
// How to get text box value?
int cid = ... ?var data = from continents in db.Continents where continents.ContinentID == cid select continents; return View(data);
}
The result of LINQ query should be displayed on next view. Thank you in advance. Goran
-
How to execute method n-times in a second?Thanks for the answer. Yes. I supposed this couldn't be resolved to be absolutely accurate. But what to do? I need to write the application that should load test WCF RIA service and the results should be confidential.
-
How to execute method n-times in a second?Thanks for your answer. I've tried to use System.Timers.Timer and the results a bit better. But, there's one thing I've noticed. Sometimes, the number of items I've added to listbox is greater than number I've entered to text box. For example, when I enter 11 to text box, the number of items in list box is 12. The order is as follows: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 1. I don't understand why 1 again?
-
How to execute method n-times in a second?Hi, I have WindowsForms application where I should execute method n-times in a second. The method should be executed inside of its own separate thread. I use thread pool for that purpose. UI contains text box where I enter the number of times of execution and button, which I click to start processing. I've tried to use System.Windows.Forms.Timer but it works for smaller number of executions (~ up to 100). It works means for example 50 calls can be done in 1 second. When the number of calls is growing they can't be executed in 1 second. They need more and more time. The code looks as follows:
private int count = 0; private int tps; public Form1() { InitializeComponent(); ThreadPool.SetMaxThreads(500, 500); } private void button1\_Click(object sender, EventArgs e) { listBox1.Items.Clear(); timer1.Enabled = true; tps = Int32.Parse(textBox1.Text); timer1.Interval = 1000 / tps; timer1.Start(); label1.Text = "Start time: " + DateTime.Now.ToString("hh:mm:ss.fff"); label2.Text = "End time: "; } private void timer1\_Tick(object sender, EventArgs e) { ThreadPool.QueueUserWorkItem(new WaitCallback(DoWork)); } private void DoWork(object stateInfo) { count++; listBox1.Items.Add(count); if (count == tps) { count = 0; timer1.Stop(); label2.Text = label2.Text + " " + DateTime.Now.ToString("hh:mm:ss.fff"); timer1.Enabled = false; } label3.Text = listBox1.Items.Count.ToString(); }
Do you have an idea how I can resolve this issue? Thank you in advance. Regards, Goran
-
Using WCF RIA service in non-Silverlight .NET applicationHi, I have a problem to use one type of WCF RIA service in non-Silverlight .NET application. For example, I want to use it in WPF application. I know how to use domain service that has method like this:
[Query(IsDefault = true)]
public IQueryable GetContinents()
{
return this.ObjectContext.Continents;
}But, when I try to add some custom method to domain service class, which is decorated with [Invoke] attribute:
[Invoke]
public string MakeWordUpper(string text)
{
return text.ToUpper();
}it's not visible in "Add Service Reference" dialog in WPF application. Only GetContinents method is visible. How can I make it work? Thank you in advance.
-
Error: The remote server returned an unexpected response: (400) Bad RequestHi, I have WCF service inside ASP.NET Web application that is hosted on IIS 7. We're encoding and decoding some strings. Decoding works well, but when we try to encode some very long XML the following error comes up:
System.ServiceModel.ProtocolException was unhandled
Message=The remote server returned an unexpected response: (400) Bad Request.
Source=mscorlib
StackTrace:
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 [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at TestClient.ServiceReference.IUfoDecoderService.Encode(String xml)
at TestClient.ServiceReference.UfoDecoderServiceClient.Encode(String xml) in C:\gtk\Amphora\WCF\UfoDecoderWebApplication\TestClient\Service References\ServiceReference\Reference.cs:line 69
at TestClient.Form1.button2_Click(Object sender, EventArgs e) in C:\gtk\Amphora\WCF\UfoDecoderWebApplication\TestClient\Form1.cs:line 42
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m) -
The maximum string content length quota (8192) has been exceeded while reading XML data. This quota may be increased...Thank you, but it doesn't help me. I've tried several things, but it's not working. Please, here's my app.config file on client side:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IUfoDecoderService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="2147483647" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="2147483647"
maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost/UfoDecoderWebApplication/UfoDecoderService.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IUfoDecoderService"
contract="ServiceReference.IUfoDecoderService" name="BasicHttpBinding_IUfoDecoderService" />
</client>
</system.serviceModel>
</configuration>My automatically generated (by VS2010) Web.config file looks as follows:
<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
--><configuration>
<connectionStrings>
<add name="ApplicationServices"
connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true"
providerName="System.Data.SqlClient" />
</connectionStrings><system.web>
<compilation debug="true" targetFramework="4.0" /><authentication mode="Forms"> <forms loginUrl="~/Account/Login.aspx" timeout="2880" /> </authentication>
-
The maximum string content length quota (8192) has been exceeded while reading XML data. This quota may be increased...Could someone, please, help me about this? Thank you in advance.
-
The maximum string content length quota (8192) has been exceeded while reading XML data. This quota may be increased...Thank you for the link, but there's nothing about how I should alter my Web.config file. I've tried several things, but it doesn't work. I really don't understand Microsoft. What's the purpose of this apporach? People should concentrate to infrastructure instead of coding. In my opinion it's wrong. How to alter Web.config file?
modified on Tuesday, May 31, 2011 11:48 PM