|
I am hoping someone can explain to me the rationale behind the Page.RegisterStartupScript method... What does it achieve that simply writing your script to a Literal doesn't? I've never had a reason to use it - if I want to add JavaScript to a page I simply do that. I am no doubt being very silly, but..
|
|
|
|
|
It ensures the script is only registered once.
For example, if you have a UserControl, you could have multiple instances of it on the page. Writing the script to a literal would output one copy of the script for each instance of the control, whereas RegisterStartupScript would (normally) only output one copy.
It also ensures that the script is rendered at the bottom of the form, rather than scattered throughout the markup. Not a huge issue, but very satisfying if you have OCD.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
OK... so if you have multiple user controls with scripts in then, yes, I see that makes sense. Otherwise though... (and I generally place my literal at the bottom of the page anyway )
Ta.
|
|
|
|
|
In addition to ensuring the script is only written once, if you are writing a user control then you can only control the mark-up inside that control, so it wouldn't be possible to inject a label for js at the bottom of the page.
My biggest issue with RegisterStartupScript etc is the name, it should be changed to RegisterStartupScriptPleaseNoteThatYourJSIsNOTBeingExecutedImmediatelyInServerSideCode
|
|
|
|
|
Hi, I am creating a scheduling website for a university project using Visual Studios. It is a website for managing shifts and schedules and the main event of the website is the scheduler which will display employee shifts within it. I have never created a timetable/calendar/scheduler in Visual Studios before. How can I produce a simple scheduler in C# that can be modified and links to a database?
|
|
|
|
|
|
Hi Vincent,
Thanks for the reply. I have searched Google for resources and I couldn’t find what I wanted; so I turned to forums with the hope that people who have successfully created schedules in Visual Studios could give me their knowledge.
The links that you gave me are just what I need. I will attempt compiling the code and editing it to suit my needs. Thanks again.
|
|
|
|
|
Maybe you could look at quartz.net
and
Hangfire
|
|
|
|
|
i read a article on DDD and also read one on onion architecture from csharpcorner. some how i felt both are same but have different name only.
please some one let me know your thought. if there is any difference then please mention in details. thanks
|
|
|
|
|
I wonder whether this post is a bit misplaced.
Nevertheless, I'm just in a middle of reading Eric Evan's book and I see DDD as a much broader concept than onion architecture. The second one stands for how you organize your application components. Although DDD also to some extent operates with those components and also advocates some patterns (side-effect free functions, specification pattern, bounded-context etc) I would say that the crucial idea behind DDD is a ubiquitous language which is formed by close cooperation between domain experts (here is where the name comes from) and developers.
|
|
|
|
|
I think its same, but I am not very sure about it.
|
|
|
|
|
i am familiar with OAuth but not with open id.
Nowadays many web site allow us to login to their site with facebook, linkedin etc. so when we click on facebook image then we redirected to facebook login page where we provide our facebook credential. if credential is right then facebook redirect us to first site. the advantage is we do not have to create & remember many credentials rather remember one.
but i do not know what is open id and how it works? i read this article http://www.devcurry.com/2012/11/aspnet-mvc-4-external-login-using-openid.html
it seems that in case of both open id and oauth user create their login to external site and user use that credential to other web site to login. if it is right then oauth and open id both are same and doing same purpose. so where is the difference?
please discuss how open id is different from oauth in terms of flow ?
|
|
|
|
|
|
i have seen a forum stackoverflow where user can login with openid and oauth to post their question.
in both case 3rd party validate user and send a token to stackoverflow to get access.
so how we can say openid is authentication system and oauth is authorization system because in case of stackoverflow access both does the same thing.
looking for further discussion. thanks
|
|
|
|
|
Mou_kol wrote: openid is authentication system and oauth is authorization system because in case of stackoverflow access both does the same thing.
No. they're not the same. Again, OAuth is basically a protocol that supports authorization workflows. What this means is that it gives you a way to ensure that a specific user has permissions to do something and that’s it.
OAuth isn’t meant to do stuff like validate a user’s identity — that’s taken care of by an Authentication service (e.g login with Facebook, Google, any other form of OpenID credentials or your own custom authentication service). Authentication is when you validate a user’s identity (like asking for a username / password to log in) -- that's what an OpenID, whereas authorization is when check to see what permissions an existing user already has.
It just that SO is an OpenID provider and as well as an OAuth2 Consumer: Stack Exchange is an OpenID Provider - Stack Overflow Blog[^]
|
|
|
|
|
Is there any Architecture similar to asp.net boilerplate?
|
|
|
|
|
How to process master detail JSON with WCF?
I would like to know, is there any guide on how to create WCF to process master detail JSON and insert it into SQL Server database?
|
|
|
|
|
How to Use Entity Framework Code?
|
|
|
|
|
Start by studying the documentation and online tutorials.
|
|
|
|
|
|
Hi,
I am using WCF Service to get data from Entity Framework, I am getting the following error while I am trying either trying to get data from service or while converting the returned data into jSon, its a huge list with more than 200K records each record might be of size 20 columns.
public ActionResult FDER_Read([Kendo.Mvc.UI.DataSourceRequest] Kendo.Mvc.UI.DataSourceRequest request)
{
using (ReportsClient reportclient = new ReportsClient())
{
CommonFunctions.IgnoreCertificationErrors();
try
{
var data = reportclient.GetFDER(GetCurrentFiscalPeriod(), GetCurrentUser());
var serializer = new JavaScriptSerializer();
var result = new ContentResult();
serializer.MaxJsonLength = Int32.MaxValue;
result.Content = serializer.Serialize(data.ToDataSourceResult(request));
result.ContentType = "application/json";
return result;
}
catch (Exception ex)
{
throw ex;
}
}
}
I have set the bindings to support max values I am not sure what am I missing?
Here is my ASP.Net MVC applications Web Config
<binding name="CustomBinding_IReports" closeTimeout="00:25:00" openTimeout="00:25:00" receiveTimeout="00:25:00" sendTimeout="00:25:00"
maxBufferPoolSize="2147483647" maxBufferSize="2147483647" >
<security defaultAlgorithmSuite="Default" authenticationMode="SspiNegotiated"
requireDerivedKeys="true" includeTimestamp="true" messageSecurityVersion="WSSecurity11WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10"
requireSignatureConfirmation="false">
<localClientSettings detectReplays="true" />
<localServiceSettings
replayCacheSize="800000"
detectReplays="true"
replayWindow="00:05:00" />
</security>
<textMessageEncoding>
<readerQuotas maxDepth="32" maxStringContentLength="2147483646" maxArrayLength="2147483646" maxBytesPerRead="2147483646" maxNameTableCharCount="2147483646"/>
</textMessageEncoding>
<httpsTransport maxReceivedMessageSize="2147483647" authenticationScheme="Negotiate"
maxBufferPoolSize="2147483647" maxBufferSize="2147483647" />
</binding>
Here is my WCF Service Web Config
<binding name="crsSecureHttpBinding"
maxConnections="100"
closeTimeout="00:30:00"
openTimeout="00:30:00"
receiveTimeout="00:30:00"
sendTimeout="00:30:00"
transactionFlow="false"
transferMode="Buffered" maxDepth="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxStringContentLength="2147483647" maxNameTableCharCount="2147483647"
maxBufferSize="2147483647"
maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" >
<transactionFlow />
<security>
<localServiceSettings replayCacheSize="8000000" replayWindow="00:30:00" />
</security>
<textMessageEncoding>
<readerQuotas maxDepth="32" maxStringContentLength="2147483646" maxArrayLength="2147483646" maxBytesPerRead="2147483646" maxNameTableCharCount="2147483646"/>
</textMessageEncoding>
<httpsTransport maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" authenticationScheme="Negotiate" />
</binding>
The size of the returned object is: 96479088 and number of records are: 196411
I am not understanding what am I missing. I defined the Service and End point behaviors, any help would be greatly helpful, thanks in advance - please.
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
-- modified 7-Mar-18 19:54pm.
|
|
|
|
|
That's a lot of data to return in a single request. But are you sure the error is caused by the size of the response, and not something else? I couldn't see the error details in your question.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I have a markup page that was using CommandField delete button. This was later replaced with regular button control.
Code:
<table>
<tr>
<td>
<asp:gridview ID="Gridview1" RowStyle-Wrap="false" gridlines="None" CssClass="responsiveTable1" runat="server" ShowFooter="true" AutoGenerateColumns="false" OnRowDeleting="Gridview1_RowDeleting">
<Columns>
<asp:BoundField DataField="RowNumber" Visible="false" HeaderText="Row Number" />
<asp:TemplateField HeaderText="Name">
<headerstyle horizontalalign="Left" />
<ItemTemplate>
<asp:TextBox ID="txtsourcename" placeholder="Name...(e.g, Jane Doe)" runat="server" style="width:375px;" AutoPostBack="true" class="form-control textClass" OnTextChanged="txtsourcename_TextChanged"></asp:TextBox><br />
<asp:CheckBox ID="grid1Details" ClientIDMode="Static" runat="server" Checked="false" AutoPostBack="true" OnCheckedChanged="Grid1CheckChanged" /><span style="color:#ff0000">*Check this box if N/A</span>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Address">
<ItemStyle HorizontalAlign="Left"></ItemStyle>
<ItemTemplate>
<asp:TextBox ID="txtsourceaddress" placeholder="Address..." runat="server" style="width:375px;" class="form-control textClass"></asp:TextBox><br /><br />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="">
<ItemTemplate>
<asp:Button ID="ButtonAdd" runat="server" Text="Add"
onclick="ButtonAdd_Click" CssClass="grvAddButton" /><br /><br /><br>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="">
<ItemTemplate>
<asp:Button ID="sourceDelete" runat="server" Text="Delete" CommandName="Delete"
CssClass="grvDelButton" OnClientClick="return confirm('Are you sure you want to remove this row?')" /> <br /><br /><br />
</ItemTemplate>
</asp:TemplateField>
<%-- <asp:CommandField ShowDeleteButton="True"><ControlStyle CssClass="grvDelButton" /></asp:CommandField>--%>
</Columns>
</asp:gridview>
</td>
</tr>
</table>
The delete button is used to delete any additional / unwanted rows created in dynamically generated row in GridView.
Since the commandField delete button was replaced, the VB the engineers the delete action is now throwing an error:
Unable to cast object of type 'System.Web.UI.WebControls.TemplateField' to type 'System.Web.UI.WebControls.CommandField'
Does anyone know how to modify this to reflect the button control ID used in markup instead of CommandField?
Protected Sub GrvSource_RowDataBound(sender As Object, e As GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.Header Then
If e.Row.RowIndex = -1 Then
DirectCast(DirectCast(e.Row.Cells(4), DataControlFieldCell).ContainingField, CommandField).ShowDeleteButton = False
End If
Else
If Convert.ToInt32(ViewState("rowIndex" & 0)) = e.Row.RowIndex Then
DirectCast(DirectCast(e.Row.Cells(4), DataControlFieldCell).ContainingField, CommandField).ShowDeleteButton = True
End If
End If
End Sub
Thank in advance
|
|
|
|
|
You don't need to worry about the header row, since the ItemTemplate doesn't apply there.
So that just leaves the Else block, which is toggling the button's visibility based on a condition. You can do the same thing with a data-binding expression.
Something like this should work:
<asp:Button ID="sourceDelete" runat="server"
...
Visible='<%# Convert.ToInt32(ViewState("rowIndex" & 0)) = Container.DisplayIndex %>'
/>
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hi Richard,
You always come up with the simplest, easy to understand solutions.
Thank you very much.
As I understand, I need to trash the VB portion of the code and just use the Visible='<#...))
If so, the delete button is still visible.
It needs to be invisible until the Add button is clicked.
|
|
|
|