|
I think there are a couple of nots missing.
|
|
|
|
|
Me make a mistake? Unlikely
|
|
|
|
|
To err is human ... I assume you are human.
|
|
|
|
|
I can't figure out why my 2 route values won't render for ActionLink. I'm stumped on this!
Oh, the first one customerID renders fine.
@Html.ActionLink("Edit", "CustomerEditor", "Admin", new { customerID = item.CustomerID, action = "edit" }, new { @class = "action edit" })
@Html.ActionLink("Delete", "CustomerEditor", "Admin", new { customerID = item.CustomerID, action = "delete" }, new { @class = "action delete" })
|
|
|
|
|
All the other words work, and even task = "delete" works.
Maybe action is a key word, and can't be used.
[edit]
I changed the word from action to operation.
It must be a key word to razor.
modified 4-Feb-16 18:47pm.
|
|
|
|
|
Presumably because "action" is already defined in the route as the name of the controller action you're calling?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
There it is!
I looked at it several times, thought maybe I needed a new route.
There I go again taking the examples literally. I need to stop that, but in foresight I will get the hang of MVC. I'm starting to like this MVC, but less time to write things.
At least I'm typing out c# pretty naturally now without having to lookup things.
Thanks Richard for pointing that out!
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
|
|
|
|
|
MS SQL Server 2012 Database
Table = ZoningInfo
Field = DistrictID from Table ZDistrict
Would like to display DistrictDesc instead of DistrictID in DetailsView.
Changed the Text Box to a DropDownbox.
When I display the page is shows the dropdown but not the underlying DistrictID/DistrictDesc. It displays the first item in the List for ZDistrict.
Any Help would be great.
Thanks
Jack
|
|
|
|
|
I don't understand what you are asking.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Asp.net detailview
The table that is connected to it has a field called District.
That field is populated from another table called Zdistrict.
The bound field is DistrictID.
I want to display the description(distdesc) instead of the number. I was thinking of using a drop down to do this.
How do I get this to work?
Thanks
|
|
|
|
|
Member 12171613 wrote: I want to display the description(distdesc) instead of the number. But where are you stuck? If you have code that is showing a field from your database and you want it to be a different field, then change the field. Where is the issue?
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
If I'm reading that correctly, your list is binding to the table, but not selecting the correct value. If that's the case, it sounds like you're missing the binding on the SelectedValue property of the list:
<asp:DropDownList id="DistrictList" runat="server"
DataSourceID="..."
DataValueField="DistrictID"
DataTextField="DistrictDesc"
SelectedValue='<%# Bind("DistrictID") %>'
/>
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hi All,
I am trying to build an telephone central dashboard (broadsoft).
This system is using httpwebrequests to select data.
First i need to build an channel to broadsoft. This works correct. I do get an channelId and expire time back from this server.
Then i would like to subscribe an event over this channel. When i try that i get an error that the channel that i just made doesn't exist (expiry time for this channel did not expired).
This is my code:
1. URL
public DataSet EventRequest(string request, string id = null)
{
string method = string.Empty;
string url = string.Empty;
string xml = string.Empty;
bool chunked = false;
switch (request)
{
case "CreateEventChannel":
method = "POST";
url = "http://xsp.voipit.nl/com.broadsoft.async/com.broadsoft.xsi-events/v2.0/channel/";
xml = "<?xml version='1.0' encoding='UTF-8'?><Channel xmlns='http://schema.broadsoft.com/xsi'><channelSetId>SomeChannelSetId</channelSetId><priority>1</priority><weight>50</weight><expires>3600</expires></Channel>";
chunked = true;
break;
case "CreateSubscription":
method = "POST";
url = "http://xsp.voipit.nl/com.broadsoft.xsi-events/v2.0/user/<userId>";
xml = "<?xml version='1.0' encoding='UTF-8'?><Subscription xmlns='http://schema.broadsoft.com/xsi'> <targetIdType>User</targetIdType> <event>Standard Call</event> <expires>300000</expires> <channelSetId>SomeChannelSetId</channelSetId> <applicationId>SomeApplicationId</applicationId></Subscription>";
break;
default:
url = "";
break;
}
return GetData(url, method, xml, chunked);
}
2. Request method
public DataSet GetData(string destinationUrl, string method = null, string requestXml = null, bool chunked = false)
{
string output = string.Empty;
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(destinationUrl);
request.ProtocolVersion = HttpVersion.Version10;
request.KeepAlive = true;
request.Timeout =
request.ReadWriteTimeout = 60000;
request.Accept = @"application/xml";
request.PreAuthenticate = true;
request.ContentType = "application/xml; encoding='utf-8'";
request.SendChunked = chunked;
request.Method = method;
request.Credentials = new NetworkCredential(WebConfigurationManager.AppSettings["Username"], WebConfigurationManager.AppSettings["Password"]);
if (requestXml != string.Empty)
{
byte[] bytes;
bytes = System.Text.Encoding.ASCII.GetBytes(requestXml);
request.ContentLength = bytes.Length;
Stream requestStream = request.GetRequestStream();
requestStream.Write(bytes, 0, bytes.Length);
}
return CreateRequestDataSet(request);
}
3. Get data
public DataSet CreateRequestDataSet(HttpWebRequest request)
{
string output = string.Empty;
HttpWebResponse response = null;
try
{
response = (HttpWebResponse)request.GetResponse();
WebHeaderCollection header = response.Headers;
string StatusCode = Convert.ToString(response.StatusCode);
string StatusDescription = response.StatusDescription;
}
catch (WebException e)
{
using (WebResponse responseTest = e.Response)
{
HttpWebResponse httpResponse = (HttpWebResponse)responseTest;
string ErrorCode = httpResponse.StatusCode.ToString();
using (Stream data = responseTest.GetResponseStream())
using (var reader = new StreamReader(data))
{
string ErrorResponse = reader.ReadToEnd();
}
}
}
try
{
var encoding = ASCIIEncoding.UTF8;
using (var reader = new System.IO.StreamReader(response.GetResponseStream(), encoding))
{
output = reader.ReadToEnd();
}
}
catch (Exception) { }
DataSet ds = new DataSet();
DataTable dt = new DataTable();
using (StringReader stringReader = new StringReader(output))
{
if (output != string.Empty)
{
ds = new DataSet();
try
{
ds.ReadXml(stringReader);
}
catch (Exception) { }
}
}
return ds;
}
Can someone maybe tell me why my channel doesn't exist anymore when i call CreateSubscription
|
|
|
|
|
Does the site you're calling rely on cookies? If so, you'll need to find a way to pass the same CookieContainer[^] instance to the HttpWebRequest.CookieContainer property[^] for both the channel and subscription requests. How you do that depends on how you're calling the code.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hi, I have a word document i.e. the report I want. I have already written the lines i want in my document. The issue is I have 15 such files and I want to populate those documents with data from SQL.
Is there any way to populate document with sql data. Not talking about export to word.
Using Asp.net
SQL 2012
TIA
|
|
|
|
|
|
Thanks is there any expample online?? and will this dll cause any issue after publishing in server???
|
|
|
|
|
Yes, please feel free to Google them at your leisure.
As for causing issues....like what? I honestly don't know a blessed thing about your server infrastructure and if adding document processing libraries has been known to cause it problems, I daresay that you have bigger issues to address than report generation.
|
|
|
|
|
Thank you for your wonderful reply. by issue I mean Last time I used Interop and after publishing my code in server I was unable to generate any reports...
|
|
|
|
|
Office Interop is not supported in ASP.NET, or any other unattended application:
Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment.
OpenXML is supported, and doesn't require Office to be installed on the server.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I probably should have included that tidbit.
I'm amazed that you didn't supply the GUIDs for the assemblies from memory.
|
|
|
|
|
Hi, I have an issue, that when I send get request to my ASP.NET Web API, also my post function in my controller gets called. Here is my code, I'd appreciate if anyone could help.
I'd like to know what do I do wrong when I declare my post function that it also gets called with my get request.
both my get and post function in my controller:
public IHttpActionResult GetAffiliate(int id)
{
Classes.Data d = new Classes.Data();
Tuple<int16, affiliate=""> result = d.getAffiliateById(id);
Int16 status = result.Item1;
Affiliate affiliate = result.Item2;
if (status == 0)
{
return NotFound();
}
return Ok(affiliate);
}
[AcceptVerbs("POST")]
public HttpResponseMessage Post([FromBody]Address address)
{
Classes.Data d = new Classes.Data();
d.addressEdit(address);
return Request.CreateResponse(HttpStatusCode.OK, "Address changed.");
}
my jQuery code where I apply get request:
function getInfo() {
//point to the api
var uri = 'api/affiliate';
//clear the list div first
$("#aff_name").empty();
var aff_id = $('#aff_id').val();
$.getJSON(uri + '/' + aff_id)
.done(function (data) {...
and here is my post request in jquery:
$.ajax({
type: "POST",
data: JSON.stringify(address),
url: "api/affiliate/",
contentType: "application/json"
});
Thank you so much for your consideration.
|
|
|
|
|
Are you sure you're simply not running both bits of javascript?
|
|
|
|
|
I am using linq to sql. I want to fetch single row from stored procdure by providing specifc id and show columns data into textboxes any body have idea?
Below is my query and store procdure:
var db = new dbDataContext();
var query = from emp in db.Sp_Getvalue(idget)
select emp;
and something like below I want:
txt1.Text = query.EMP_FNAME;
txt2.Text = query.EMP_MNAME;
txt3.Text = query.EMP_LNAME;
txt4.Text = query.EMP_EMAIL;
txt5.Text = query.EMP_DOB;
|
|
|
|
|
Hi,
I am going through an issue with Telerik controls, all my Telterik Control because disabled, like RadEditor, RadListBox and RadAutoComplete. I installed the Telerik Version=2016.1.113.35, before that I was having the Telerik Version=2015.2.623.45. After installing I converted all my Application and its related components from .Net 3.5 to .Net 4.0, now all my Telerik Controls became disabled, the ones which were working before also became disabled.
Any help what could the reason and solution for it, any think like a link, a code snippet or even a suggestion would be helpful.
Here is my code:
<%@ Page Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Login.aspx.cs" Inherits="ResearchStudiesAdmin.Website.Login" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<telerik:RadAjaxLoadingPanel runat="server" ID="RadAjaxLoadingPanel1">
</telerik:RadAjaxLoadingPanel>
<telerik:RadAjaxManager runat="server" ID="RadAjaxManager1">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
<UpdatedControls>
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="radLongDesc" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings><br />
</telerik:RadAjaxManager><br />
<telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
<div class="demo-containers">
<pre>
<div class="demo-containers">
<telerik:RadEditor Height="300px" Width="700px" ID="radLongDesc" runat="server" ToolbarMode="Default"
StripFormattingOptions="all" ContentAreaMode="Div">
<tools>
<telerik:EditorToolGroup Tag="MainToolbar">
<telerik:EditorTool Name="Print" ShortCut="CTRL+P" />
<telerik:EditorTool Name="AjaxSpellCheck" />
<telerik:EditorTool Name="FindAndReplace" ShortCut="CTRL+F" />
<telerik:EditorTool Name="Cut" />
<telerik:EditorTool Name="Copy" ShortCut="CTRL+C" />
<telerik:EditorTool Name="Paste" ShortCut="CTRL+V" />
<telerik:EditorTool Name="FormatStripper" />
<telerik:EditorTool Name="PasteStrip" />
</telerik:EditorToolGroup>
<telerik:EditorToolGroup>
<telerik:EditorTool Name="Undo" ShortCut="CTRL+Z" />
<telerik:EditorTool Name="Redo" ShortCut="CTRL+Y" />
</telerik:EditorToolGroup>
<telerik:EditorToolGroup Tag="InsertToolbar">
<telerik:EditorTool Name="LinkManager" ShortCut="CTRL+K" />
<telerik:EditorTool Name="Unlink" ShortCut="CTRL+SHIFT+K" />
</telerik:EditorToolGroup>
<telerik:EditorToolGroup Tag="Superscript">
<telerik:EditorTool Name="Subscript" />
<telerik:EditorTool Name="InsertParagraph" />
<telerik:EditorTool Name="InsertHorizontalRule" />
</telerik:EditorToolGroup>
<telerik:EditorToolGroup>
<telerik:EditorTool Name="Bold" ShortCut="CTRL+B" />
<telerik:EditorTool Name="Italic" ShortCut="CTRL+I" />
<telerik:EditorTool Name="JustifyLeft" />
<telerik:EditorTool Name="JustifyCenter" />
<telerik:EditorTool Name="JustifyRight" />
<telerik:EditorTool Name="JustifyFull" />
<telerik:EditorTool Name="JustifyNone" />
<telerik:EditorTool Name="Indent" />
<telerik:EditorTool Name="Outdent" />
</telerik:EditorToolGroup>
<telerik:EditorToolGroup>
<telerik:EditorTool Name="InsertOrderedList" />
<telerik:EditorTool Name="InsertUnorderedList" />
<telerik:EditorTool Name="ToggleTableBorder" />
</telerik:EditorToolGroup>
</tools>
</telerik:RadEditor>
<br />
<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ErrorMessage="Long Description."
CssClass="ErrorMsg" ControlToValidate="radLongDesc" ValidationGroup="vgSave" Display="Dynamic"></asp:RequiredFieldValidator>
</div>
</div>
Thanks in advance.
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|