Subscribe: Custom Server Controls
http://forums.asp.net/rss.aspx?ForumID=19
Added By: Feedage Forager Feedage Grade B rated
Language: English
Tags:
btn  button  code  cookie  data  file  form  function  myvalue myvalue  myvalue  new  progress  script  select  text  var 
Rate this Feed
Rating: 2 starRating: 2 starRate this feedRate this feedRate this feed
Rate this feed 1 starRate this feed 2 starRate this feed 3 starRate this feed 4 starRate this feed 5 star

Comments (0)

Feed Details and Statistics Feed Statistics
Preview: Custom Server Controls

All Forums



All Forums



Last Build Date: Sat, 01 Oct 2016 03:59:26 -0700

 



next and last buttons not working in my datepager

2016-10-01T05:50:23.87-07:00



ShowPreviousPageButton="false" />


protected void lstView1_PagePropertiesChanging(object sender, PagePropertiesChangingEventArgs e)
{

DataPager1.SetPageProperties(e.StartRowIndex, e.MaximumRows, false);



bindAll();

}




jQuery/JavaScript function in MVC not working in production server

2016-09-30T11:12:28.157-07:00

Hi,

I have the following js function that works when I'm in development machine but not in production/hosting server.  I'm thinking that I'm not translating the function for the MVC environment.  Please see below:

In View:

function fillHucDdl(reg) {
                var huclist;
                var items;
                var hucname;
                var jsonPath = $('link[rel="' + reg + '"]').attr("href");

                //get json data from geojson
                $.getJSON(jsonPath, function (data) {
                    huclist = L.geoJson(data, {
                        onEachFeature: function (feature, layer) {
                            hucname = feature.properties.HUC_CODE;
                            items += "";
                        }
                    });

                    //populate dropdownlist with unsorted options
                    $("#hucDdl").html(items);
                });

                //sort the options
                sortSelect();
}

The dropdownlist is supposed to be populated when the Index.cshtml loads.  It does when I'm in development machine but not in production server.

Appreciate any help.




Multiple tablix and dataset

2016-09-12T11:18:55.103-07:00

Hi developers,
I am working on SSRS. There are four tablix on one page, each one has its own dataset (each dataset calls the same stored procedure and a @type parameter is passed which is different for all datasets). I need to show 10 records in each tablix one time and next records should come on next page which will again be showing 10 records in each tablix. Please let me know how can I accomplish this.

Its not necessary to use four tablix, you can provide its alternate if feasible.

Please let me know if further info required.

Thanks!!!!




how to show image thumbnail by bootstrap

2016-09-30T16:42:21.36-07:00

I need to show multiple images thumbnail in page. In each row i need to show 4 or 5 images thumbnail. There will be many rows in page. So guide me with code how to design this with bootstrap css. Plzz provide a example of css and html.



Select two Query in one Proc and read data with DataAdapter

2016-10-01T09:00:45.51-07:00

hi quys

how can write best query for get this result:

ID        USERID        VALUE1        VALUE2        VALUE3        DATE
--------------------------
1         1		myvalue       myvalue       myvalue       2012/01/01
2         5		myvalue       myvalue       myvalue       2014/04/01
3         3		myvalue       myvalue       myvalue       2015/05/01
4         2		myvalue       myvalue       myvalue       2015/07/01
5	  5		myvalue       myvalue       myvalue       2016/10/01


CURRENT DATA:   ID:5         USERID:5         myvalue       myvalue       myvalue       2016/10/01
PREVIOUS DATA:  ID:2         USERID:5         myvalue       myvalue       myvalue       2014/04/01

i used two select in query:

SELECT TOP(1) VALUE1 AS CURRENTVALUE1, VALUE2 AS CURRENTVALUE2, ...
	  WHERE [USERID] = '5' ORDER BY [DATE] DESC --(FOR CURRENT DATA)

SELECT TOP(1) VALUE1 AS PREVIOUSVALUE1, VALUE2 AS PREVIOUSVALUE2, ...
	  WHERE [USERID] = '5' AND [DATE] < (SELECT TOP(1) [DATE] FROM TB ORDER BY [DATE] DESC)
ORDER BY [DATE] DESC --(FOR PREVIOUS DATA)

cs code:

...
                sqlCmd.CommandType = CommandType.StoredProcedure;
                sqlCmd.Parameters.AddWithValue("@USERID", USERID.ToString());
                SqlDataAdapter da = new SqlDataAdapter(sqlCmd);
                da.Fill(dt);
                if (dt.Rows.Count > 0)
                {
                   CurrentValue1.Text = dt.Rows[0]["CurrentValue1"].ToString();
CurrentValue2.Text = dt.Rows[0]["CurrentValue2"].ToString(); ... PreviousValue1.Text = dt.Rows[0]["PreviousValue1"].ToString();
PreviousValue2.Text = dt.Rows[0]["PreviousValue2"].ToString(); ... } ...

and get this error:

Additional information: Column 'PreviousValue1' does not belong to table .

how can i fix this problem

thanks




Writign line of excel file : I need help to make working my code

2016-09-29T08:22:40.45-07:00

Hi, i have a part of code wher i upload the file xls, which works fine

and after i found  a code to read my xls file uploaded

var fileNametouse = "@" + path;
                                var connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + fileNametouse + ";Extended Properties=\"Excel 12.0;IMEX=1;HDR=NO;TypeGuessRows=0;ImportMixedTypes=Text\""; ;
                                using (var conn = new OleDbConnection(connectionString))
                                {
                                    conn.Open();

                                    var sheets = conn.GetOleDbSchemaTable(System.Data.OleDb.OleDbSchemaGuid.Tables, new object[] { null, null, null, "TABLE" });
                                    using (var cmd = conn.CreateCommand())
                                    {
                                        cmd.CommandText = "SELECT * FROM [" + sheets.Rows[0]["TABLE_NAME"].ToString() + "] ";

                                        var adapter = new OleDbDataAdapter(cmd);
                                        var ds = new DataSet();
                                        adapter.Fill(ds);


                                        // My foreach it is not working because he cannot work with variables type : System.data.oledb.OleDbDataAdapter
                                        foreach (var marketinglist in adapter)
                                        {
                                            
                                            //Add each email inside my db (i am not sure this is the way to add record)
                                            MarketingEmail marketingemail = db.MarketingEmails.Add(marketingemail);
                                            marketingemail.MarketingEmailEMAIL = marketinglist.CELL Column 1
marketingemail.MarketingEmailName = marketinglist.CELL Column 2 db.SaveChanges(); } } }

 My foreach it is not working because he cannot work with variables type : System.data.oledb.OleDbDataAdapter

how can i do a foreach of my styleshet and take each record an copy it in my table (in my file excel ui have 2 column : email and name)




How to have a count of record when i use ToPagedList

2016-10-01T07:34:10.317-07:00

Hi, in my view if i try to do this :

.Count()

i got only the numebr of record of the page which is the number of records per page and not the total number of my records

How can i get the total number of all the records?




Handle SignalR disconnects in WPF VB.NET

2016-10-01T07:22:50.26-07:00

I'm trying to create a WPF application in VB.NET that receives notifications via SignalR from an API. I've created a basic function to connect to the server, the hub, and consume the data. I'm not sure on how to handle reconnecting to the server once disconnected. Initially I thought I could use Start().ContinueWith() and just have it loop until successful but that neither works nor seems efficient.

Essentially I want the program to be able to handle loss of internet and system hibernation/sleep with grace and reconnect to the signalR hub when possible instead of just having it die.

Private Function CreateSignalR() As Boolean
Dim reTry = True
While reTry
    Try
        Dim qryStr As New Dictionary(Of String, String) From {{"phonenumber", My.Settings.UserName.Split("@")(1)}, {"source", "alertApp"}}
        hubConnection = New HubConnection("https://website.com/api", qryStr)
        hub = hubConnection.CreateHubProxy("notificationHub")

        hub.[On](Of String)("broadcastMessage", Sub(caller)
                                                    Dispatcher.InvokeAsync(Sub() DisplayAlerts(caller))
                                                End Sub)

        ServicePointManager.DefaultConnectionLimit = 10

        hubConnection.Start().ContinueWith(Sub(task As Task)
                                                If Not task.IsFaulted Then
                                                    reTry = False
                                                Else
                                                    reTry = True
                                                    Thread.Sleep(3000)
                                                End If
                                            End Sub).Wait()

    Catch ex As Exception
        hubConnection.Stop()
        Return False
    End Try
End While
End Function






How to Submit Data from tokeninput

2016-10-01T06:40:12.133-07:00

Hi

 How to submit data using tokeninput 

Thanks




MSBI Online Training

2016-10-01T06:17:00.3-07:00

MSBI  stands  for Microsoft Business Intelligence. This effective suite is made out of devices which helps in giving best answers for Business Intelligence and Data Mining Queries. This apparatus utilizes Visual studio alongside SQL server.| MSBI Online Training | Vmware Online Training | Openstack Online Training | MicroSoft Dynamics CRM Online Training  | (image)




The type or namespace name 'WebGrid' could not be found (are you missing a using directive or an assembly reference?)

2014-09-29T04:58:28.367-07:00

i am getting this kind of error message while running the programm as compilation error. previously i didn't get this kind of error message but suddenly i am getting the error. 

previously in all modules it's working fine but suddenly in all the modules i am getting the same error. 

what's problem behind on this




Controller to save multiple files

2016-09-30T10:13:04.323-07:00

Hi   I have the below code but ,  i want to save all the multiple selected image paths in Database . What should be the controller.
Add files...
 
 

@using (Html.BeginForm()) { @Html.AntiForgeryToken()

CategoryMapping


@Html.ValidationSummary(true, "", new { @class = "text-danger" })
@Html.LabelFor(model => model.CategoryID, "CategoryID", htmlAttributes: new { @class = "control-label col-md-2" })
@Html.DropDownList("CategoryID", null, htmlAttributes: new { @class = "form-control" }) @Html.ValidationMessageFor(model => model.CategoryID, "", new { @class = "text-danger" })
@Html.LabelFor(model => model.ParentCategoryID, htmlAttributes: new { @class = "control-label col-md-2" })
@*
*@ @*
*@
}
@Html.ActionLink("Back to List", "Index")
@section scripts{ } Thanks [...]



Need Help with Asp web Form authentications

2016-10-01T03:51:13.35-07:00

Hi I need some input on Forms Authentication. My problem seems to be that the cookie never expires Here is what I have tried:

Created blank web forms project in VS2015. Added this to the root Web.config:

    
      
    

Created a folder called 'Secured' and added a button just as a postback mechanism. Added a web.config to this folder as follows:



    
      
        
      
    

Ran it. Waited 5 minutes. Clicked to button on the page. Never got logged out or redirected to login. Checked for cookie in browser. There were 2, '.AspNet.ApplicationCookie' and '__AntiXSRFToken'. Dug deeper. Found where the 'AspNet.ApplicationCookie' was created in Startup.Auth. Altered it to force it to use values listed in web.config as follows:

            app.UseCookieAuthentication(new CookieAuthenticationOptions
            {
                AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
                CookieName = FormsAuthentication.FormsCookieName,
                LoginPath = new PathString("/Account/Login"),
                Provider = new CookieAuthenticationProvider
                {
                    OnValidateIdentity = SecurityStampValidator.OnValidateIdentity(
                        validateInterval:TimeSpan.FromMinutes(FormsAuthentication.Timeout.Minutes),
                        regenerateIdentity: (manager, user) => user.GenerateUserIdentityAsync(manager))
                }
            });

Ran the application. still no logout and redirect after a postback 5 minutes later. But, Had a Cookie named 'MyCookie' that I could delete and then after postback it would redirect and logout. So I'm thinking the cookie is just not timing out. I tried to check the Cookie Status like this on page postback:

            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(this.Request.Url);
            request.CookieContainer = new CookieContainer();
            HttpWebResponse response = (HttpWebResponse)request.GetResponse();

            foreach (Cookie cook in response.Cookies)
            {
                if (cook.Name == FormsAuthentication.FormsCookieName) { return cook.Expired; }
            }
            return false;

This showed the 'AntiXSRFToken' but not 'MyCookie'. So I'm Assuming 'MyCookie' is not part of the response object. So I needt help. I can force the logout like this:

                FormsAuthentication.SignOut();
                Session.Abandon();

                // clear authentication cookie
                HttpCookie cookie1 = new HttpCookie(FormsAuthentication.FormsCookieName, "");
                cookie1.HttpOnly = true;
                cookie1.Expires = DateTime.Now.AddYears(-1);
                Response.Cookies.Set(cookie1);
  
                FormsAuthentication.RedirectToLoginPage();

But I still do not know how to check or troubleshoot that the Authentication as actually being timed out before I do this.

Please give me some insight. And suggestions.

Thank you very much.




How do I resolve the Insert issue

2016-10-01T03:46:20.657-07:00

Hi Friends, I appreciate all of you who has been responding to my questions, you are making me great, thanks. My question now is: I has a button that is created dynamically in a GridView container, below is the click event for the button, and what I want it to do is, when the button is clicked, it will make a random select of Id from Table_A and return the result as variables then use the variables to make Insert into Table_B this is the code:                 PlaceHolder ph = (PlaceHolder)e.Row.FindControl("phGame");                 Button bt1 = new Button();                 bt1.Text = "PalsCall";                 bt1.EnableViewState = true;                 ph.Controls.Clear();                 ph.Controls.Add(bt1);                 bt1.Click += delegate                 {                                          string ID1 = null;                     string ID2 = null;                     string ID3 = null;                     string connetionString = null;                     SqlConnection con  ;                     SqlCommand cmd ;                     string sql = null;                     SqlDataReader rdr ;                     connetionString = "Data Source=MyServerName;Integrated Security=True;Connect Timeout=15;Encrypt=False;TrustServerCertificate=False";                     sql = "SELECT (Id) FROM Table_A WHERE (ABS(CAST((BINARY_CHECKSUM(Id, NEWID())) as int))% 10) < 4 ";                      con = new SqlConnection(connetionString);                     try                      {                      con.Open();             &n[...]



What does a NuGet reference signify that has no child nodes? Is this a normal thing?

2016-10-01T03:37:42.033-07:00

What do all the NuGet reference nodes mean that are a leaf node? Does that even make any sense or is something wrong with my installation? See picture of my desktop below:

(image)




Regex 10 digits not start with 0 or 1

2016-10-01T03:15:55.617-07:00

I think I have:

1st digit only 2-9

any number for the next 9

^[2-9][0-9]{9}$

does not work as intended

Typo... it works!




App pool identity same as window use

2016-09-30T02:18:05.6-07:00

Hi

I am working on asp.net form application and I would like authentication to be window.  Also, I want to set app pool identity to be the same as window user to has log in to the application.

Windows user should be use to authenticate for webapplication and also for app pool identity.

Any advice 




Passing data from PartialView to its parent View

2016-10-01T02:25:21.887-07:00

I want to pass values from a partialView (opened as a modal dialog) to the textbox in the parent view. 

The PartialView

@model IEnumerable

Members List

@foreach (var item in Model) { }
Saving Ac No Member Name Saving Product
Select @item.saving_account_no @item.memberName @item.product_name

The above partial view is called as the popup in the parent view in the following way:


@Html.TextBoxFor(x => x.memberName, new { @class = "form-control medium", @id = "memberName", style="width:80%" })

Now, when the partialView shows as a dialog, i need to do the following:

  • select one of the value from the dialog
  • close the modal after selecting the value
  • display it in the "memberName" textBox.

Help needed ASAP.
Thank you.




Another Update query problem

2016-09-13T01:41:05.97-07:00

I have a simple update query that works with a number it it for the registrantID value:

SQLEmail = "UPdate [Registrations] set [Paid] = 'Yes' where [registrantID] =  78"

However if I parameterize it as below

cmd.Parameters.Add("@RegistrantID", OleDb.OleDbType.Numeric, 8).Value = GVSelectedPersonToAddPayment.SelectedRow.Cells(1).Text
        SQLEmail = "UPdate [Registrations] set [Paid] = 'Yes'  where [RegistrantID]=@RegistrantID "

I get the error "Object reference not set to an instance of an object"

Below is a picture of the gridview so you can see where the data is (supposed to be) coming from.

(image)

I've been fiddling with this for many hours and can't seem to get it right.