Affichage des articles dont le libellé est Active questions tagged asp.net - Stack Overflow. Afficher tous les articles
Affichage des articles dont le libellé est Active questions tagged asp.net - Stack Overflow. Afficher tous les articles

samedi 1 août 2015

How do i use an AutoPostback functionality for a radsearchbox?

By default, some of the telerik radcontrols are having autopostback option, but for radsearchbox, the auto postback functionality was not available, is it possible to achieve that in code?

Adding Security Header Username and password in API

Iam a Beginner in C#.Now iam working on one API on which iam facing one Exception

"Soap Exception :No security Header Found".

I just tried to add

CBANK.Service cService = new CBANK.Service();
cService.ClientCredentials.UserName.UserName = "username";
cService.ClientCredentials.UserName.Password= "Password";

but i cant find Clientcredentials in my service.My Webconfig settings is

<bindings>
        <customBinding>
            <binding name="ServiceComPortBinding" receiveTimeout="02:00:00" sendTimeout="02:00:00" openTimeout="02:00:00" closeTimeout="02:12:00">
                <transactionFlow transactionProtocol="WSAtomicTransactionOctober2004"/>
                <security defaultAlgorithmSuite="Basic128" authenticationMode="UserNameForCertificate" requireDerivedKeys="false" securityHeaderLayout="Strict" includeTimestamp="true" keyEntropyMode="CombinedEntropy" messageProtectionOrder="SignBeforeEncrypt" messageSecurityVersion="WSSecurity11WSTrust13WSSecureConversation13WSSecurityPolicy12BasicSecurityProfile10" requireSignatureConfirmation="false">
                    <localClientSettings cacheCookies="true" detectReplays="true" replayCacheSize="900000" maxClockSkew="01:00:00" maxCookieCachingTime="Infinite" replayWindow="01:00:00" sessionKeyRenewalInterval="10:00:00" sessionKeyRolloverInterval="01:0:00" reconnectTransportOnFailure="true" timestampValidityDuration="01:00:00" cookieRenewalThresholdPercentage="60"/>
                    <localServiceSettings detectReplays="true" issuedCookieLifetime="10:00:00" maxStatefulNegotiations="128" replayCacheSize="900000" maxClockSkew="01:00:00" negotiationTimeout="01:00:00" replayWindow="01:01:00" inactivityTimeout="01:00:00" sessionKeyRenewalInterval="15:00:00" sessionKeyRolloverInterval="01:00:00" reconnectTransportOnFailure="true" maxPendingSessions="128" maxCachedCookies="10000" timestampValidityDuration="01:00:00"/>
                    <secureConversationBootstrap/>
                </security>
                <textMessageEncoding maxReadPoolSize="64" maxWritePoolSize="16" messageVersion="Soap11WSAddressing10" writeEncoding="utf-8">
                    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
                </textMessageEncoding>
                <httpTransport manualAddressing="false" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" allowCookies="false" authenticationScheme="Anonymous" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" keepAliveEnabled="true" maxBufferSize="65536" proxyAuthenticationScheme="Anonymous" realm="" transferMode="Buffered" unsafeConnectionNtlmAuthentication="false" useDefaultWebProxy="true">
                    <extendedProtectionPolicy policyEnforcement="Never"/>
                </httpTransport>
            </binding>
        </customBinding>
    </bindings>

can somebody help me to solve this issue.

show Jquery Form Validation message Next to bootsrap Textbox

i have a form implemented using Bootstrap and now validating form using jquery validate plugin. validations are working fine but i want to show validation messages next to textbox field but currently it is showing below to my text box

here is my html code :

<div class="form-group">
  <div class="col-md-2">
   <label for="forTypeName" class="control-label">Trainer Name</label>
  </div>
  <div class="col-md-10">
    <input type="text" class="form-control" id="txtname" name="txtname">
  </div>
</div>

and my JS Code is

   var validator = $("#sjform").validate({
            rules: {
                txtname: "required"

            },
            messages: {
                txtname: "Required"
            },
            errorPlacement: function (error, element) {
            //    error.appendTo($(element).parent().next());
            error.insertAfter(element);
            },

            //highlight: function (element) {
            //    $(element).closest('.form-group').addClass('has-error');
            //},
            //unhighlight: function (element) {
            //    $(element).closest('.form-group').removeClass('has-error');
            //},
            highlight: function (element) {
                $(element).parent().removeClass('has-success').addClass('has-error');
            },
            unhighlight: function (element) {
                $(element).parent().removeClass('has-error').addClass('has-success');
            },
            errorElement: 'span',
            errorClass: 'help-block',
            submitHandler: function (form) {
                form.submit();
            }
        });

devs any help please.. thanks in advance

Explain IIS caching and webapi requests

Who can explain the behavior IIS cache and webapi requests.

We have: 1. IIS 7 2. WebApi (Ap.Net Framework 4.5, MVC, C#). 3. IIS Settings: Site -> Output caching -> Edit Feature Settings: "Enable cache" and "Enable kernel cache" -- are enabled.

Current request:

POST http://ift.tt/1IAuPT2 HTTP/1.1
Host: www.example.com
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0
Accept: application/json, text/plain, */*
Content-Type: application/json;charset=utf-8
Content-Length: 32

{language":"en"}

With every request throughout the day, response time increases. (request and query parameters always the same ) So: -first response on current request is 10ms. -after 100 request - 5 sec. -after 1000 requests to api -response will >10 sec

These numbers are approximate. I was made measurements every hour during the working day. And response time for current request every time was more than previous.

After I disabled "Enable cache" and "Enable kernel cache" in IIS site settings, response time became normal.

update panel in master page and asyncpostbacktrigger in content page

I have a cart in master page that this cart is inside update panel.
In my content page I have a listview that in this listview exist linkbutton for add product to my cart.
I want to add product to cart using these linkbuttons without refresh, and cart is updated. I have this code in my content page:
`protected void Page_Init(object sender, EventArgs e) { UpdatePanel up = (this.Master.Master.FindControl("UpCart")) as UpdatePanel;

    AsyncPostBackTrigger trigger = new AsyncPostBackTrigger();
    trigger.ControlID = lvNewProducts.UniqueID;
    trigger.EventName = "ItemCommand";
    up.Triggers.Add(trigger);



}`

but my page is refreshed when I click in linkbutton.
Please help me!

vendredi 31 juillet 2015

An expression of non-boolean type specified in a context where a condition is expected, near 'AdmissionID'

Server Error in '/' Application.

An expression of non-boolean type specified in a context where a condition is expected, near 'AdmissionID'.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: An expression of non-boolean type specified in a context where a condition is expected, near 'AdmissionID'.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[SqlException (0x80131904): An expression of non-boolean type specified in a context where a condition is expected, near 'AdmissionID'.]
   System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +1767866
   System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +5352418
   System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +244
   System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) +1691
   System.Data.SqlClient.SqlDataReader.TryConsumeMetaData() +61
   System.Data.SqlClient.SqlDataReader.get_MetaData() +90
   System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +365
   System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds) +1406
   System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite) +177
   System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +53
   System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) +134
   System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) +41
   System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior) +10
   System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +140
   System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +316
   System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) +86
   System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +1481
   System.Web.UI.WebControls.ListControl.OnDataBinding(EventArgs e) +101
   System.Web.UI.WebControls.ListControl.PerformSelect() +34
   System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +30
   System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +105
   System.Web.UI.WebControls.BaseDataBoundControl.set_RequiresDataBinding(Boolean value) +9844021
   System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewChanged(Object sender, EventArgs e) +15
   System.Web.UI.DataSourceView.OnDataSourceViewChanged(EventArgs e) +105
   System.Web.UI.WebControls.SqlDataSourceView.SelectParametersChangedEventHandler(Object o, EventArgs e) +31
   System.Web.UI.WebControls.ParameterCollection.OnParametersChanged(EventArgs e) +20
   System.Web.UI.WebControls.Parameter.UpdateValue(HttpContext context, Control control) +142
   System.Web.UI.WebControls.ParameterCollection.UpdateValues(HttpContext context, Control control) +101
   System.Web.UI.WebControls.ParameterCollection.GetValues(HttpContext context, Control control) +36
   System.Web.UI.WebControls.SqlDataSourceView.InitializeParameters(DbCommand command, ParameterCollection parameters, IDictionary exclusionList) +257
   System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +589
   System.Web.UI.WebControls.ListControl.OnDataBinding(EventArgs e) +101
   System.Web.UI.WebControls.ListControl.PerformSelect() +34
   System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +30
   System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +105
   System.Web.UI.WebControls.ListControl.OnPreRender(EventArgs e) +23
   System.Web.UI.Control.PreRenderRecursiveInternal() +83
   System.Web.UI.Control.PreRenderRecursiveInternal() +155
   System.Web.UI.Control.PreRenderRecursiveInternal() +155
   System.Web.UI.Control.PreRenderRecursiveInternal() +155
   System.Web.UI.Control.PreRenderRecursiveInternal() +155
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +974

My SQL Command is like this >> SELECT * FROM [Bed] WHERE WardID = @WardID AND BedStatus = 'Available' AND BedNo NOT IN (SELECT BedNo FROM [AdmissionDetail], [Admission] WHERE ([AdmissionDate] <= @AdmissionDate AND [DischargeDate] >= @DischargeDate AND AdmissionStatus <> 'Discharged' AND [AdmissionDetail]AdmissionID = [Admission]AdmissionID))

I'm using Visual Studio 2013 and using asp:DropDownList and asp:SqlDataSource to do this. I have 4 table which is Admission, AdmissionDetail, Ward and Bed.

GridView with Template Column and Image Inside

I have a GridView with one template column which contains a user control (an Image and a Label). I use the code below to get list of images in a directory:

string[] filePaths = Directory.GetFiles(Server.MapPath("~/Resources/Pictures"),"*.jpg");
        GridView1.DataSource = filePaths;
        GridView1.DataBind();

It will create an extra column which contains the image's path. for example if we have 5 files in the folder, then we have 5 rows in our gridview. But in first column which is a template column with user control, you can see raw image and raw label. It means in every row we have a template column with raw controls and a column which contains image's path getting from code above. I need to access the user control's image and label control and update them in each row.

For example if in first row image's path is "~/pics/.jpg" I need to update the image control's imageurl to this path so we can see the image and then I need to update the label's text into another text.

How Can I do this and access to template column's controls in each row?

mvc rout and get string

im begginer in asp.net mvc

i write this rout code

    routes.MapRoute(
        name: "test",
        url: "test/{name}",
        defaults: new { controller = "Home", action = "test"}
    );

and this controller

public ActionResult test(string data)
{                   

    switch (data)
    {
        case "test1":
            return View("test1");
        case "test2":
            return View("test2");
        case "test3":
            return View("test3");
        default:
            return View("test1");
    }

}

and in my url http://localhost:3598/test/test1

but i get null data in parameter in controller

how i can get 'test1' in switch (data) ?

thank you for your help

annoying temporary files often while building project in Visual Studio 2012?

"hi, Many time, the following error occurs while running the asp.net project in Visual Studio 2012

[![> Error 24 The file name 'C:\Users\hr\AppData\Local\Temp\Temporary

ASP.NET Files\online invoice\7c64e6a9\cbf90bd2\qkrvpnfc.res' was already in the collection. Parameter name: fileName]1]1

Even though temporary files deleted, the above error occurring repeatedly.

Please help, thanks a lot"

RadAjaxManager OnRequestStart is not fired when press for the second time on a button?

RadAjaxManager OnRequestStart is not fired when press for the second time on a button.

1. Button post back working good. 2. No javascript error.

Code Here:

Rad code block

    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script type="text/javascript">
            var currentLoadingPanel = null;
            var currentUpdatedControl = null;
            var btn1 = $find("<%= btnsave.ClientID%>");
            function requestStart(sender, args) {
                currentLoadingPanel = $find("<%= RadAjaxLoadingPanel1.ClientID%>");
                btn1 = $find("<%= btnsave.ClientID%>");
                if (args.get_eventTarget() == "<%= btnsave.UniqueID %>") {
                    currentUpdatedControl = "<%= importprocess.ClientID %>";
                    //show the loading panel over the updated control   
                    currentLoadingPanel.show(currentUpdatedControl);
                }
            }

            function responseEnd() {

                //hide the loading panel and clean up the global variables               
                if (currentLoadingPanel != null) {
                    currentLoadingPanel.hide(currentUpdatedControl);
                }
                currentUpdatedControl = null;
                currentLoadingPanel = null;

            }

        </script>
    </telerik:RadCodeBlock>
    <telerik:RadAjaxManager ID="RadAjaxManager1"  runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="btnstart">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="importprocess" />
                </UpdatedControls>
            </telerik:AjaxSetting>
              <telerik:AjaxSetting AjaxControlID="btnsave">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="btnsave" ></telerik:AjaxUpdatedControl>
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
         <ClientEvents OnRequestStart="requestStart" OnResponseEnd="responseEnd"></ClientEvents>
    </telerik:RadAjaxManager>

RadAjaxLoadingPanel

When I selecting the combobox items its deleting or refreshing the attachments the file

I developed the compose message from email,

I attaching the files then i have selecting the combo box item its deleting the attachment files.

Here my ASP Code:

<asp:UpdatePanel ID="updatepanel" runat="server">
                                            <ContentTemplate>
                                                <tr>
                                                    <td valign="top">
                                                        <asp:Label ID="lblfile_name" runat="server" CssClass="labels">Upload File</asp:Label>
                                                    </td>
                                                    <td>
                                                        <div style="overflow-y: scroll; z-index: auto; height: 60px;">
                                                            <asp:FileUpload ID="FileUpload1" runat="server" CssClass="multi" Visible="true" />
                                                        </div>
                                                    </td>
                                                </tr>
                                            </ContentTemplate>
                                        </asp:UpdatePanel>


                                           <tr>
                                            <td>
                                                <telerik:RadComboBox EmptyMessage="----- Select -----" ID="cboTemplate" runat="server" Skin="WebBlue" AutoPostBack="true">
                                                </telerik:RadComboBox>
                                            </td>

                                        </tr>

Here VB. NET CODE

   Private Sub cboTemplate_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cboTemplate.SelectedIndexChanged
    If cboTemplate.SelectedValue = "--Select--" Then
        lblErrMsg.Text = objcmnfunctions.GetErrMsg("B2B_WAR_110")
        SetFocus(anc_err)
        Exit Sub
    End If
    objdbconn.OpenConn()
    msSQL = " Select mailtemplate_gid, template_name, template_content " & _
            " from crm_trn_tmailtemplates " & _
            " where mailtemplate_gid = '" & cboTemplate.SelectedValue & "'"
    objOdbcDataReader = objdbconn.GetDataReader(msSQL)
    If objOdbcDataReader.HasRows = True Then
        objOdbcDataReader.Read()
        radmailcontent.Content = objOdbcDataReader.Item("template_content").ToString
    End If
    objOdbcDataReader.Close()
    objdbconn.CloseConn()
End Sub

Error in Importing data from excel file to database using c#.net

Here is my code...

constr = string.Format(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties=""Excel 12.0 Xml;HDR=YES;""", FilePath);

    Econ = new OleDbConnection(constr); ExcelConn(FilePath);
    Econ.Open();

    Query = string.Format("Select [Emp ID],[Emp Name],[Log Date],[LogTime],[Type] FROM [{0}]", "One Month Report$");
    OleDbCommand Ecom = new OleDbCommand(Query, Econ);

    DataSet ds = new DataSet();
    OleDbDataAdapter oda = new OleDbDataAdapter(Query, Econ);
    Econ.Close();
    oda.Fill(ds);
    DataTable Exceldt = ds.Tables[0];

    //creating object of SqlBulkCopy    
    SqlBulkCopy objbulk = new SqlBulkCopy(conn);
    //assigning Destination table name    
    objbulk.DestinationTableName = " Attendancetable";
    //Mapping Table column
    objbulk.ColumnMappings.Add("Emp ID", "Emp ID");
    objbulk.ColumnMappings.Add("Emp Name", "Emp Name");
    objbulk.ColumnMappings.Add("Log Date", "Log Date");
    objbulk.ColumnMappings.Add("LogTime", "LogTime");
    objbulk.ColumnMappings.Add("Type", "Type");
    //inserting Datatable Records to DataBase    
    conn.Open();
    objbulk.WriteToServer(Exceldt);
    conn.Close();

Using this code am getting "External table is not in expected formt" this error. opened excel sheet uploading is successfull but in closed excel sheet file uploading process showing this error. please anyone help me out.

how to call button's click event from click of linkbutton of another page without post back in c# ASP.NET

i have a LinkButton in masterpage and on click of LinkButton , i am redirecting to, say, Page1.aspx . On Page1.aspx , i have a button1. On click of that button1, i am opening new window, not affecting data of the Page1.aspx.

but when i click on LinkButton of masterpage, redirecting to Page1.aspx and from code behind,clicking button1 , Page1.aspx 's data gets changed.

how to prevent this. i am providing my code..

LinkButton on Masterpage :

<asp:LinkButton ID="lnkAppointMent" runat="server" OnClick="lnkAppointMent_Click"><span>Appointment Scheduler </span></asp:LinkButton>

click Event of LinkButton :

protected void lnkAppointMent_Click(object sender, EventArgs e)
        {
            Session["PhoneCenter"] = "Appointment";
            Response.Redirect("PhoneMessage.aspx");
        }

PageLoad of redirecting page(PhoneMessage.aspx) :

    protected void Page_Load(object sender, EventArgs e)
                {
                    fillCustomTypeMessages();            
                    if (!Page.IsPostBack)
                    {
                        .

    .

    .
                        else if (Session["PhoneCenter"].ToString() == "Appointment")
                        {
                            btnScheduleAppointments_Click(btnScheduleAppointments, null);
                        }

.

.

.

RaisPostBack method on PhoneMessage.aspx :

protected override void RaisePostBackEvent(IPostBackEventHandler source, string eventArgument)
        {
            try
            {
                base.RaisePostBackEvent(source, eventArgument);
            }
            catch (Exception ex)
            {


            }

.

.

Click event of button :

protected void btnScheduleAppointments_Click(object sender, EventArgs e)
        {
            if (!Permissions.checkPermissions(Session["employeeloggedin"].ToString(), "PHMSGVMD"))
            {
                ScriptManager.RegisterStartupScript(this, Page.GetType(), "OnLoad", "alert('You must have the Phone Messages: View and Modify permission to schedule appointments!')", true);
            }
            else
            {
                string script = String.Format("openNewWin('" + "phonescheduler.aspx" + "')");
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "openNewWin", script, true);
            }

        }

Script :

function openNewWin(url)
        {
            alert(url);
            var open_link = window.open('', '_blank');
            open_link.location = url;
        }

Any clarification needed. please comment..

I want to create a custom function in jquery with few controls as parameters. How can I achieve this?

Have a checkbox and want to enable disable many ddl according to its onchecked >functionality. I have atleast 14 checkboxes I need to accomplish this in.. Is >it possible to do this using jquery?


enter code here

");" Checked="false" />

enter code here $(function enablecheck(chk,ddl) { $('[id$=chk]').on('click', function () { if ($(this).is(":checked")) {

               ddl.prop("disabled", false);

            } else {
                ddl.prop("disabled", true);

            }
        })
    });

user account specific connectionstrings

I am a novice in C# MVC and I have a MVC5 project, where each specific user will be connected to a specific mssql db. So is it possible to set a user-specific connectionstrings in the web.config. My second question is, as the number of users will grow, will this kind of set up (one project with many user-specific connection strings) will affect the speed?

how do i get purchased items to a gridview in a shopping cart?

Hey I recently created a shopping cart but I'm having problems sorting the purchased items into a gridview. this is my cart class:

Public Class Cart
    Private dt As DataTable = New DataTable()

    Public Sub New()
        dt.Columns.Add(New DataColumn("Product ID"))
        dt.Columns.Add(New DataColumn("Quantity"))
        dt.PrimaryKey = New DataColumn() {dt.Columns("Product ID")}
    End Sub

    Public Sub AddToCart(ByVal prd_id As Integer, ByVal quantity As Integer)
        Dim dr As DataRow = dt.NewRow()
        dr("Product ID") = prd_id
        dr("Quantity") = quantity
        dt.Rows.Add(dr)
    End Sub

    Public Sub RemoveFromCart(ByVal prd_id As Integer)
        Dim dr As DataRow = dt.Rows.Find(prd_id)
        dt.Rows.Remove(dr)
    End Sub

    Public Function GetCart() As DataTable
        Return dt
    End Function
End Class

this is the button function:

If Session("Customer_ID") <> Nothing Then
Dim userCart As Cart = CType(Session("shoppingCart"), Cart)
Dim qty As Integer = txtqty.text
Dim pid As Integer = lblid.text
userCart.AddToCart(pID, qty)
Else 
Response.Redirect("User_Login.aspx")
End If

when I try to run the code I get an error saying that ("Object reference not set to an instance of an object.") please help I've completely ran out of ideas. how can i fix this?

IIS 8.5 Web.config for named SQL instance on alternate port

I recently upgraded to Windows Server 2012 from 2003. It was a big IIS jump from 6 to 8.5. I cannot seem to get a named SQL instance on an alternate port to work in my ASP.net 4.0 website. The connection string I am using is as follows:

<add name="MyConn" connectionString="Server=192.168.12.5\stage,7839;Database=mydb;uid=myun;pwd=mypw;" />

When the website tries to load in the browser, I get the following error:

[HttpException (0x80004005): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 0 - No connection could be made because the target machine actively refused it.)]

We've checked firewall settings to no avail. Is the syntax correct in the above example? I've done numerous searches and found examples of people using

192.168.12.5:7839\stage

or

192.168.12.5\stage;port=7839;

but both of those give syntax errors.

I need some confirmation on the correct syntax for the Web.config file. Any help is greatly appreciated, thanks!

displaying data in a rdlc report using a method

My project uses a repository pattern so I have already written a method in my business logic layer that gets the information I need from the database to display an invoice for a customer. Can I use this method to display data in the report I created? If so, how?

All of the examples I've seen query the database directly.

Detailed documentation about mapping a web templete inside Orchard CMS

I found a web template on the net link and I want to allow end-users to edit the website using CMS. I found Orchad CMS, which is based on ASP.Net MVC. But the problem I'm facing is that I didn't find the full documentation on how I can map a web template similar to the one I provide to be managed inside a CMS such as Orchard so that end-users (non-technical users) can add new images, change the home page message, add new projects, etc.

How can I execute some Javascript after all ASP.NET startup scripts have been executed?

I have an ASP.NET page with a variety of client-side controls being initialized via ClientScriptManager.RegisterStartupScript. I have another script that I need to ensure runs only after all of the registered startup scripts have executed, without having control over the order they're registered in.

Is there any way I can make my script execute only after the start up scripts have been run?