|
Thank you so much
I think it is the wisest way
|
|
|
|
|
<pre lang="sql">Scenario is I have one parent and on child page. Child page contain list of say countries. I was using showModalDialog function in java script which is easily returned the value I had selected in my child page. Recently this functionality is not working in chrome as in new update they have deprecated showModalDialog function. Please suggest me some alternative to achieve this.
I tried same using different methods but issue I am facing is there are multiple values returning from child which I have to split and assign to my hidden values in parent:</pre>
|
|
|
|
|
You have already posted this in QA[^].
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
public DataSet ReadPreviousProperty(Guid appIDValue)
{
DataSet ds1 = new DataSet();
try
{
con = new SqlConnection(connectionString);
SqlDataAdapter da1 = new SqlDataAdapter(); ;
SqlCommand cmd1 = new SqlCommand("[sp_ReadPreviousProperty]", con);
cmd1.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@ApplicationID", SqlDbType.UniqueIdentifier).Value = appIDValue;
if (con.State == ConnectionState.Closed)
con.Open();
da1.SelectCommand = cmd1;
da1.SelectCommand.Connection = con;
da1.Fill(ds1, "tblPropertyMaster");
}
catch (Exception ex)
{
//MessageBox.Show(ex.Message);
}
finally
{
if (con.State == ConnectionState.Open)
con.Close();
}
return ds1;
}
cmd.Parameters.Add("@ApplicationID", SqlDbType.UniqueIdentifier).Value = appIDValue;
this line raises error ,object reference is not set to an instance
please check my code and answer
|
|
|
|
|
Have a look into AddWithValue[^]. your syntax is wrong, the .VALUE is invalid in the constructor.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Huma Ansari wrote:
SqlCommand cmd1 = ...
cmd.Parameters.Add(...
Those are two different variables. You're getting a NullReferenceException because you haven't initialized the cmd variable.
Change your code to either:
cmd1.Parameters.Add("@ApplicationID", SqlDbType.UniqueIdentifier).Value = appIDValue;
or:
cmd1.Parameters.AddWithValue("@ApplicationID", appIDValue);
Other comments:
The SqlDataAdapter class takes care of opening and closing your connection for you, so there's no need to explicitly open the connection before calling the Fill method.
The SqlCommand constructor has already assigned the connection; there's no need to set da1.SelectCommand.Connection to the same connection instance.
You should also look at wrapping your connection and command objects in using blocks, and avoid storing them in fields.
using (SqlConnection con = new SqlConnection(connectionString))
using (SqlCommand cmd = new SqlCommand("[sp_ReadPreviousProperty]", con))
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@ApplicationID", appIDValue);
SqlDataAdapter da1 = new SqlDataAdapter();
da1.SelectCommand = cmd;
DataSet ds1 = new DataSet();
da1.Fill(ds1, "tblPropertyMaster");
return ds1;
}
Finally, using sp_ as the prefix for a stored procedure is not a good idea:
http://sqlperformance.com/2012/10/t-sql-queries/sp_prefix[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
<script type="text/javascript" language="JavaScript">
function PrintPage(pageheader) {
var wPageHeader = pageheader
var curDate;
var advNo='<%=ddlAdvertise.selecteditem.text%>';
var post='<%=ddlPost.selecteditem.text%>';
var wOption = "width=875,height=525,menubar=yes,scrollbars=yes,location=no,left=20,top=20";
var wWinHTML = document.getElementById('printArea1').innerHTML;
var wWinPrint = window.open("", "", wOption);
wWinPrint.document.open();
wWinPrint.document.write("<html><head><link href='../Styles/Print.css' rel='stylesheet'><title>e-Despatch</title></head><body>");
wWinPrint.document.write("<div id='header'><div style='float:center;margin-top:10px;'></div> <div style='float:center; margin-top:0px;' width='220'>       <b> Advertisement No:"+advNo+"</b>       <b> Post Code:"+post+"</b></div><div style='float:center;margin-top:0px;'><b>"+wPageHeader+"</b></div><div style='float:right' align='right'><div align='right' id='printDate'></div></div><div style='clear:both'></div></div>")
//wWinPrint.document.write("<div align='center' id='printHeader'>" + wPageHeader + "</div>");
//wWinPrint.document.write("<div align='right' id='printDate'>"+curDate+"</div>");
wWinPrint.document.write(wWinHTML);
wWinPrint.document.write("</body></html>");
wWinPrint.document.close();
wWinPrint.focus();
}
</script>
|
|
|
|
|
But only the data in current grid was captured using the following method
mya=jQuery(”#list2″).getDataIDs(); // Get All IDs"
If I like to export all data (e.g. totally 18 records, 10 displayed in current grid and 8 in second grid page), is there a way to capture all 18 records without invoking the backend?
i am not finding any solution only first page data is capturing in excel ...
I am using
var jqgridRowIDs = $(tableCtrl).getDataIDs(); // Fetch the RowIDs for this grid
var allJQGridData = $(tableCtrl).jqGrid('getRowData');
var headerData = $(tableCtrl).getRowData(jqgridRowIDs[0]);
Plz help me out.....
|
|
|
|
|
Can you not dump data source of the jqgrid and save as csv?[^]
dev
|
|
|
|
|
i was just reading a article on Self hosting SignalR Application in Win Service from this url http://damienbod.wordpress.com/2014/06/03/signalr-self-hosting-template-for-a-windows-service/
code was not very clear to me.so here i am pointing out those line of code point wise. apologized for bit big question.
namespace SignalREngineServiceWindowsService
{
static class Program
{
static void Main(string[] args)
{
ServiceBase.Run(new SignalREngineServiceWindowsService());
if (args != null)
{
try
{
Startup.StartServer();
Console.ReadKey();
}
finally
{
Startup.StopServer();
}
}
}
}
}
[assembly: OwinStartup(typeof(Startup))]
namespace SignalREngine
{
public class Startup
{
static CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource();
public static void StartServer()
{
var cancellationTokenSource = new CancellationTokenSource();
Task.Factory.StartNew(RunSignalRServer, TaskCreationOptions.LongRunning
, cancellationTokenSource.Token);
}
private static void RunSignalRServer(object task)
{
string url = "http://localhost:8089";
WebApp.Start(url);
}
public static void StopServer()
{
_cancellationTokenSource.Cancel();
}
public void Configuration(IAppBuilder app)
{
app.Map("/signalr", map =>
{
map.UseCors(CorsOptions.AllowAll);
var hubConfiguration = new HubConfiguration
{
};
hubConfiguration.EnableDetailedErrors = true;
map.RunSignalR(hubConfiguration);
});
}
}
}
1) just see this line...what is the meaning
ServiceBase.Run(new SignalREngineServiceWindowsService());
how we can instantiate namespace because this is the namespace name SignalREngineServiceWindowsService i think we should specify the class name...what u say!
2)
public static void StartServer()
{
var cancellationTokenSource = new CancellationTokenSource();
Task.Factory.StartNew(RunSignalRServer, TaskCreationOptions.LongRunning
, cancellationTokenSource.Token);
}
here we are calling a method with TPL but what is the meaning of this option or param TaskCreationOptions.LongRunning and cancellationTokenSource.Token ?
3)
private static void RunSignalRServer(object task)
{
string url = "http://localhost:8089";
WebApp.Start(url);
}
see this url string url = "http://localhost:8089"; here can't we specify machine IP where self host apps will run? is it mandatory to write like localhost ?
4)
public static void StopServer()
{
_cancellationTokenSource.Cancel();
}
what will happen when this line will be invoked _cancellationTokenSource.Cancel(); ?
how it can stop the signalr hub ?
5)
public void Configuration(IAppBuilder app)
{
app.Map("/signalr", map =>
{
map.UseCors(CorsOptions.AllowAll);
var hubConfiguration = new HubConfiguration
{
};
hubConfiguration.EnableDetailedErrors = true;
map.RunSignalR(hubConfiguration);
});
}
who will call Configuration() function because i found no routine in code from where Configuration() will be called ?
6) RunSignalR() ? is any built-in function ?
7) what is the difference between this line map.RunSignalR(hubConfiguration); and map.MapSignalR(); ?
8) i found another approach to point out the startup class....here it is
static void Main(string[] args)
{
string url = "http://localhost:6118";
using (WebApp.Start<Startup>(url))
{
Console.WriteLine("The Server URL is: {0}", url);
Console.ReadLine();
}
}
class Startup
{
public void Configuration(IAppBuilder MyApp)
{
MyApp.MapSignalR();
}
}
what is Startup class & what it does or what its role in self hosting ?
i just go through a article and after reading it lots of confusion occur. so i just need answer for my question. so it will be great if some one answer point wise.
here i am including few more url which also talk about signalr selfhost but their coding approach is bit different but understandable.
here is those url
http:
https:
http:
tbhattacharjee
|
|
|
|
|
I had developed a dot net website in c#.I want to embed a video in my website,which should be compatible in all browsers without using html5.I had tried but the video is playing or compatible on IE only.What should i do.please provide some suggestions or code.I will be grateful to you.
|
|
|
|
|
I am getting the following error
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<soap:Header>
<wsa:Action>http://schemas.xmlsoap.org/ws/2004/08/addressing/fault</wsa:Action>
<wsa:MessageID>urn:uuid:13dee3e0-d36f-4b94-b769-d981fe391ed8</wsa:MessageID>
<wsa:RelatesTo>urn:uuid:a506294f-dea5-4ada-b1b2-a3677e00dcce</wsa:RelatesTo>
<wsa:To>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:To>
<wsse:Security>
<wsu:Timestamp wsu:Id="Timestamp-0b0b00f2-2c73-47cb-b951-0f2f8f555dd8">
<wsu:Created>2014-10-12T20:04:40Z</wsu:Created>
<wsu:Expires>2014-10-12T20:09:40Z</wsu:Expires>
</wsu:Timestamp>
</wsse:Security>
</soap:Header>
<soap:Body>
<soap:Fault>
<faultcode xmlns:q0="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">q0:Security</faultcode>
<faultstring>Microsoft.Web.Services3.Security.SecurityFault: Header http://schemas.xmlsoap.org/ws/2004/08/addressing:Action for ultimate recipient is required but not present in the message.
at Microsoft.Web.Services3.Design.RequireSoapHeaderAssertion.RequireSoapHeaderFilter.ProcessMessage(SoapEnvelope envelope)
at Microsoft.Web.Services3.Pipeline.ProcessInputMessage(SoapEnvelope envelope)
at Microsoft.Web.Services3.WseProtocol.FilterRequest(SoapEnvelope requestEnvelope)
at Microsoft.Web.Services3.WseProtocol.RouteRequest(SoapServerMessage message)
at System.Web.Services.Protocols.SoapServerProtocol.Initialize()
at System.Web.Services.Protocols.ServerProtocol.SetContext(Type type, HttpContext context, HttpRequest request, HttpResponse response)
at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing)</faultstring>
<faultactor>http://localhost:4190/AeslPSWebService.asmx</faultactor>
</soap:Fault>
</soap:Body>
</soap:Envelope>
and my request is as follows
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header>
<_0:Security soap:actor="www.toromont.com" soap:mustUnderstand="true" xmlns:_0="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:_0_1="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
<_0_1:Timestamp _0_1:Id="Timestamp-135">
<_0_1:Created>2014-10-10T13:48:35.832Z</_0_1:Created>
<_0_1:Expires>2014-10-19T13:53:35.832Z</_0_1:Expires>
</_0_1:Timestamp>
<_0:UsernameToken _0_1:Id="UsernameToken-136">
<_0:Username>sa</_0:Username>
<_0:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">Allied@CAT</_0:Password>
</_0:UsernameToken>
</_0:Security>
<par:UserCredentials xmlns:par="http://www.cat.com/MT/2008/11/15/PartStoreRequiredService"/></soapenv:Header>
<soapenv:Body>
<se:getCustomerInformation xmlns:se="http://www.cat.com/MT/2008/11/15/PartStoreRequiredService" xmlns:xsd="http://customerlookup.partstore.domain.webservice.midtier.websolutions.dcs.cat/xsd">
<se:custLookUpInput>
<xsd:custNo>99008</xsd:custNo>
<xsd:custType xsi:nil="true"/>
<xsd:dealerCode>X130</xsd:dealerCode>
</se:custLookUpInput>
</se:getCustomerInformation>
</soapenv:Body>
</soapenv:Envelope>
I have developed this web service for our vendor based on the wsdl they provided. Please help as i am unable to find any solution of it.
|
|
|
|
|
|
I currently find where the user clicked inside an image using e.X and e.Y in an onclick method, but I'd like to show the user what he's pointing at before he clicks and does a postback to the server. Rather like a mouseover. However, I haven't been able to pick up a mouseover event with a JScript function in my .net page.
I barely know JScript, but I have used functions to handle onkeypress events.
Any pointers, articles, links or well-deserved cynical remarks?
|
|
|
|
|
This seems to be a case of never getting the line of code right when doing something you're unsure of. It works this way:
<script>
function myMoveFunction() {
document.getElementById("ImageCaption").innerHTML = "Coords: " + event.x + ", " + event.y ;
}
</script>
<asp:ImageButton id="imagebutton1" runat="server" Width="512" Height="262"
ImageUrl="DrawRoom.aspx?v=0"
OnClick="ImageButton_Click"
onmousemove="myMoveFunction()" />
|
|
|
|
|
Dear all,
I am running the following script on the client-side and the script is failing to update, when there is change in the database. I debugged the script using web-browser debugger and discovered my Jquery scripts are responding back as "304 not modified". I am assuming the server code is sending 304 resp. if so, what tests can I carry out, to help me debug server code, to find where the logic maybe going wrong.
Client-side:
<script src="../Scripts/jquery-1.6.4.js"></script>
<script src="../Scripts/jquery.signalR-2.1.2.min.js"></script>
<script src='<%: ResolveClientUrl("~/signalr/hubs") %>'></script>
<script type="text/javascript">
$(function () {
var notifications = $.connection.NotificationHub;
notifications.client.recieveNotification = function (role, descrip) {
$('#spanNewMessages').text(role);
$('#spanNewCircles').text(descrip);
};
$.connection.hub.start().done(function () {
notifications.server.sendNotifications();
alert("Notifications have been sent.");
}).fail(function (e) {
alert(e);
});
});
</script>
<h1>New Notifications</h1>
<div>
<br />
New <span id="spanNewMessages"></span> = role.<br />
New <span id="spanNewCircles"></span> = descrip.<br />
</div>
The server side code is created signalR hub class and also has sql dependency logic as well:
[HubName("NotificationHub")]
public class notificationHub : Hub
{
string role = "";
string descrip = "";
[HubMethodName("sendNotifications")]
public void SendNotifications()
{
using (var connection = new SqlConnection(ConfigurationManager.ConnectionStrings["##########"].ConnectionString))
{
string query = "SELECT top 1 [role],[description] FROM [dbo].[User] order by uploadDate desc";
connection.Open();
SqlDependency.Start(GetConnectionString());
using (SqlCommand command = new SqlCommand(query, connection))
{
try
{
command.Notification = null;
DataTable dt = new DataTable();
SqlDependency dependency = new SqlDependency(command);
dependency.OnChange += new OnChangeEventHandler(dependency_OnChange);
if (connection.State == ConnectionState.Closed)
connection.Open();
var reader = command.ExecuteReader();
dt.Load(reader);
if (dt.Rows.Count > 0)
{
role = dt.Rows[0]["role"].ToString();
descrip = dt.Rows[0]["description"].ToString();
}
connection.Close();
}
catch (Exception ex)
{
throw ex;
}
}
}
Clients.All.RecieveNotification(role, descrip);
}
private void dependency_OnChange(object sender, SqlNotificationEventArgs e)
{
if (e.Info == SqlNotificationInfo.Insert)
{
notificationHub nHub = new notificationHub();
nHub.SendNotifications();
}
}
Any hints would be very much appreciated. Many thanks
|
|
|
|
|
Is there availbe free sms api through we can sms . using c# asp.net application
|
|
|
|
|
|
Directory Listing -- /MyWebTutorial/
--------------------------------------------------------------------------------
Thursday, October 09, 2014 04:59 PM <dir> bin
Thursday, October 09, 2014 04:49 PM <dir> Images
Thursday, October 09, 2014 05:20 PM <dir> JavaScript
Thursday, October 09, 2014 06:51 PM 2,070 MasterPage.Master
Thursday, October 09, 2014 04:18 PM 343 MasterPage.Master.cs
Thursday, October 09, 2014 06:51 PM 782 MasterPage.Master.designer.cs
Thursday, October 09, 2014 06:51 PM 4,968 MyWebTutorial.csproj
Thursday, October 09, 2014 06:51 PM 1,088 MyWebTutorial.csproj.user
Thursday, October 09, 2014 04:15 PM <dir> obj
Thursday, October 09, 2014 04:15 PM <dir> Properties
Thursday, October 09, 2014 04:28 PM <dir> Styles
Thursday, October 09, 2014 05:45 PM 2,014 Web.config
Thursday, October 09, 2014 04:15 PM 1,285 Web.Debug.config
Thursday, October 09, 2014 04:15 PM 1,346 Web.Release.config
--------------------------------------------------------------------------------
Version Information: ASP.NET Development Server 10.0.0.0
|
|
|
|
|
That is not an error. That is a directory listing of your site.
You're seeing it because you haven't created a default page - default.aspx - for your site.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
How to maintain scroll position in chrome in Asp .Net.
I write code for this ...
<pages theme="DarkBlue" maintainScrollPositionOnPostBack="true" asyncTimeout="50000">
in web.config file.
It's work in Mozilla but does't work in chrome.
Can any one help me?
|
|
|
|
|
Have you checked for the value of maintainScrollPositionOnPostBack in you code to see if something may be resetting it?
I was working on a web page that involved adding code from a third-party and this was changing the value of maintainScrollPositionOnPostBack. We therefore had to reset the value in our code.
|
|
|
|
|
|
I stumped on this one. I want to replace everything in the test text with something else.
I have this
Dim expDIV As String = "(^<div id="specialFooter"|ID="specialFooter")(.*)(</div>)"
Dim elementDIV As System.Text.RegularExpressions.MatchCollection = _
Regex.Matches(p_MessageXHTML, expDIV)
to work this the test text
<div id="specialFooter" class="default_Wrapper_Footer">Anything can be here</div>
But I can't seem to get a match with my expression. I used the actual double quotes at first, then switched to the quot;.
Maybe I should html encoode the input for the match first, but then I would have to encode on the replace as well.
Any help or suggestion would be appreciated.
|
|
|
|
|
Try this:
Dim expDIV As String = "<div\s+(?=[^>]*\b(?i:id)=""specialFooter"")[^>]+>(.+?)</div>"
Dim elementDIV As MatchCollection = Regex.Matches(p_MessageXHTML, expDIV)
This will ignore the case for the name of the id attribute, and will allow the attributes to appear in any order.
If you want the entire match to be case-insensitive, then use:
Dim expDIV As String = "<div\s+(?=[^>]*\bid=""specialFooter"")[^>]+>(.+?)</div>"
Dim elementDIV As MatchCollection = Regex.Matches(p_MessageXHTML, expDIV, RegexOptions.IgnoreCase)
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|