Subscribe: Web Forms
http://forums.asp.net/rss.aspx?ForumID=18
Added By: Feedage Forager Feedage Grade B rated
Language: English
Tags:
code  function  int  label  mdrd  new  public int  public string  public  search  set public  set  string  taglib  text 
Rate this Feed
Rate this feedRate this feedRate 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: Web Forms

All Forums



All Forums



Last Build Date: Fri, 24 Mar 2017 23:13:51 -0700

 



3 tier architecture in MVC

2017-03-09T12:50:37.87-08:00

Can anybody suggest me any link for creating a 3 Tier architecture Entity framework in MVC using code first approach .




DataType

2017-03-25T06:01:11.877-07:00

Hi

  I am using CkEditor. What should be the DataType of field Notes.

Thanks




Refresh gridview data with response redirect

2017-03-25T05:59:42.607-07:00

The print button in below grid view it opens print page in new tab. Using this java-script code. Java Script Also the print button updates OrderStatus from 'Pending' to 'Received' The problem is when i press the print button in the grid data is not refreshed i have to reload the page to see that OrderStatus has been changed to the updated value. Behind-Code protected void gridOrders_RowCommand(object sender, GridViewCommandEventArgs e) { try { string commandName = e.CommandName.ToString().Trim(); GridViewRow row = (GridViewRow)(((LinkButton)e.CommandSource).NamingContainer); GridViewRow gvRow = (GridViewRow)((Control)e.CommandSource).NamingContainer; Int32 rowind = gvRow.RowIndex; string orderid = row.Cells[1].Text; switch (commandName) { case "Print": if (r.CheckReceiving(orderid)) { Session["orderid"] = orderid; Server.Transfer("OrderPrint.aspx"); } else { string msg = r.AddReceiving(r.GetNextReceivingID(), orderid, DateTime.Now.ToString()); if (msg == "true") { o.UpdateOrderStatus(orderid, "Received"); gridOrders.DataSource = o.ManageOrders(UtilityClass.ReadFromCookie("login", "OutletD", Request)); gridOrders.DataBind(); Session["orderid"] = orderid; Server.Transfer("OrderPrint.aspx"); } else { divreceivedfalse.Visible = true; } } break; default: break; } } catch (Exception ex) { Response.Write("Error: " + ex.Message); } } Grid Is Inside UpdatePanel CausesValidation="False" Text=''>       [...]



Relationship between 2 classes

2017-03-13T12:22:29.893-07:00

Hi

  I have 2 classes . How i can create CountryId as Foreign Key in States Class

public class Country
    {
        [Key]
        public int CountryId { get; set; }
        public string CountryName { get; set; }
    }

    public class State
    {

        [Key]
        public int StateId { get; set; }
        public string StateName { get; set; }
        public int CountryId { get; set; }
    }

Thanks




Image

2017-03-25T05:30:04.303-07:00

Hi

  How to display image in JqGrid on the basis of Column condition if true or false. 

Thanks




Session is not updating

2017-03-25T05:28:33.36-07:00

when i am updating database, profile are also updated but that session are updated after i logout and then login,how to fix it in asp.net




How do I start with a simple search application

2017-03-14T13:50:59.823-07:00

Hi there,

I have a simple database with 3 columns - id, zip codes and salesmen.  I want to create an MVC application that has just one field to enter zip code and a Search button. Once the zip code is typed, I want to search the database and display the name of the salesperson corresponding to the entered zip code.

I read some documentation on Entity Framework and got quite confused. Can someone give me a guideline as how should I proceed. I'm new to asp.net MVC. I'm coding this application in c#.

Joe




Dash Board sidebar menu

2017-03-15T12:42:38.577-07:00

Hi

Please can you provide me html   code how to write  a dash board side bar menu using html . Please help

Regards

Pol




Relationship

2017-03-25T05:08:25.393-07:00

Hi

  I have 3 below Entities. How to create relationship between them using Entity Code First Approach

public class Country
    {
        [Key]
        public int CountryId { get; set; }

        [DisplayName("Country")]
        public string CountryName { get; set; }
    }

    public class State
    {
        [Key]
        public int StateId { get; set; }

        [DisplayName("State")]
        public string StateName { get; set; }
        public int CountryId { get; set; }
    }

    public class City
    {
        [Key]
        public int CityId { get; set; }

        [DisplayName("City")]
        public string CityName { get; set; }
        public int StateId { get; set; }
    }

Thanks




Search filters

2017-03-15T15:10:53.273-07:00

Hi,

I need bit of help/advise on how displaying search filters on my web shop. In my web shop I have different product categories like Skin care , hair care , after shave makeup etc. As each of these product categories can have completely different searchable attributes so if user click on Skin care then only skin care attributes should appear in search filter. I am not sure how to achieve this. One way I can think of is to have separate view for each category and set the filters related to each category separately (hard code) but this will cause problem every time a new product category is added. I want to create it dynamic.

Any suggestions.

Thanks

 




Object cannot be cast from DBNull to other types

2017-03-25T04:06:39.68-07:00

Hello

This is my code

                       
                        
                            
                           
                        
                            
                         
                    

How to avoid this below from the above code

Object cannot be cast from DBNull to other types.

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.InvalidCastException: Object cannot be cast from DBNull to other types.




Merge Data And Show Output

2017-03-24T11:31:36.827-07:00

Hello
This is my Table1 data

RefNo           CustomerName
R1                  Niki

This is my Table2 data

RefNo BoxNo   ItemName   Qty
R1	50	A           5    
R1	51	B           2
R1	52	C           4
R1	52	D           3
R1	53	D           1

I want Output like this

RefNo	Customer_Name	BoxNo	ItemName       Qty
R1	Niki		50	A		5
R1	Niki		51	B		2
R1	Niki		52	C,D		7
R1	Niki		53	D		1

 




Multiple Search not working

2017-03-15T17:53:24.05-07:00

Hi   When i click on find nothing is works. It is hitting  GetList Post Method. $(function () { $("#grid").jqGrid({ url: "/Registerations/GetList", datatype: 'json', mtype: 'Get', colNames: ['FirstName', 'LastName', 'email', 'Country', 'State'], colModel: [ { key: false, name: 'FirstName', index: 'FirstName', editable: true,search: true, stype: 'text', searchoptions: { sopt: ['eq', 'ne'] } }, { key: false, name: 'LastName', index: 'LastName', editable: true, search: true, stype: 'text', searchoptions: { sopt: ['eq', 'ne'] } }, { key: false, name: 'email', index: 'email', editable: true, search: true, stype: 'text', searchoptions: { sopt: ['eq', 'ne'] } }, { key: false, name: 'CountryName', index: 'CountryName', editable: true }, { key: false, name: 'StateName', index: 'StateName', editable: true}], pager: jQuery('#pager'), rowNum: 10, rowList: [10, 20, 30, 40, 50], height: '100%', sortname: 'FirstName', sortorder: 'asc', viewrecords: true, emptyrecords: 'No Records are Available to Display', autowidth: true, multiselect: false }).navGrid('#pager', { edit: true, add: true, del: true, refresh: true }, { zIndex: 100, url: '/Registerations/Edit', closeOnEscape: true, closeAfterEdit: true, recreateForm: true, afterComplete: function (response) { if (response.responseText) { alert(response.responseText); } } }, { zIndex: 100, url: "/Registerations/Create", closeOnEscape: true, closeAfterAdd: true, afterComplete: function (response) { if (response.responseText) { alert(response.responseText); } } }, { zIndex: 100, url: "/Registerations/Delete", closeOnEscape: true, closeAfterDelete: true, recreateForm: true, msg: "Are you sure you want to delete ? ", afterComplete: function (response) { if (response.responseText) { alert(response.responseText); } } } ); }); function advancedSearching() { $('input[name=rdSearchingApproach]').attr('disabled', true); $('#grid').searchGrid({ multipleSearch: true }); }; View
Advanced

Controller [AcceptVerbs(HttpVerbs.Post)] public ActionResult GetList(FormCollection postData) { string sortExpression = postData["sidx"]; string sortDirection = postData["sord"]; int pageIndex = Convert.ToInt32(postData["page"]); int pageSize = Convert.ToInt32(postData["rows"]); string filterExpression = String.Empty; if (Convert.ToBoolean(postData["_search"])) { //Preparing filter expression for single field approach [...]



Populate multiple dropdownlist and view from three different tables

2017-03-16T04:55:04.92-07:00

Hello all, transitioning from asp.net to mvc 5. How would you populate two dropdownlist on a view from three different table. One table for the view, one table to populate one of the dropdownlist and the other table to populate the other dropdownlist, also would need to handle style for dropdowns from CSS.

My View

@ModelType AppIn.Models.MenuAll

Create New Menu




@Html.ActionLink("Menu List", "Index")




@Html.ValidationSummary("", New With {.class = "text-danger"})

@Using Html.BeginForm("CreateNewMenu", "MenuAll", FormMethod.Post, New With {.class = "form-horizontal", .role = "form"})
@Html.AntiForgeryToken()
@



@Html.LabelFor(Function(m) m.menuDescriminatorSelectedItem, New With {.class = "mdrd_table-label-text"})


@Html.DropDownListFor(Function(m) m.menuDescriminatorSelectedItem, Model.menuDescriminatorItems, New With {.class = "mdrd_big-dropdownlist"})


@Html.LabelFor(Function(m) m.menuTypeSelectedItem, New With {.class = "mdrd_table-label-text"})


@*@Html.DropDownListFor(Function(mt) mt.menuTypeSelectedItem, Model.menuTypeItems, New With {.class = "mdrd_big-dropdownlist"})*@




End Using
Code Page (Controller)


Function CreateNewMenu() As ActionResult
ViewBag.Title = "Create New Menu" & CookieHandler.GetCurrentStoreName

Dim cLanguageId As Integer = Nothing
If Request.Cookies("CurrentLanguageId") Is Nothing Then
AppIn.Classes.CookieHandler.SetCurrentLanguage()
If CInt(Request.Cookies("CurrentLanguageId").Value) = -1 Then
Dim lHelper = New AppIn.Models.LanguageHelper
cLanguageId = lHelper.LanguageId
End If
cLanguageId = CInt(Request.Cookies("CurrentLanguageId").Value)
Else
cLanguageId = CInt(Request.Cookies("CurrentLanguageId").Value)
End If

Dim mdl = Nothing
Using db As New ApplicationDbContext
If db.Roles.Any Then
Dim itm = db.Roles.Where(Function(rl) rl.Available = True And rl.Language = cLanguageId)
For Each item In itm
mdl = New Roles With {
.menuDescriminatorItems = {
New SelectListItem() With {.Value = item.Id, .Text = item.Role}
}
}
Next
End If
End Using

Return View()

'Dim db As New ApplicationDbContext
'Dim item As IEnumerable(Of SelectListItem)
'item = db.Roles.Select(Function(rl) New SelectListItem() With {
' .Value = rl.Id,
' .Text = rl.Role})

'ViewBag.Descriminator = item

'Dim model = MenuDescriminator.DescriminatorMenu
'Return View()

End Function

Please Help



How to populate a dropdownlist based on selection from another dropdown

2017-03-16T16:22:03.247-07:00

I have two Dropdownlist (country and state). I want when I select a country from the country dropdown, it will populate the states for that country. I need the JQuery script that can do that for me. Please help

Here are my codes

Country

 public int CountryId { get; set; }
 public string CountryName { get; set; }
    

State

 public int StateId { get; set; }
 public Nullable CountryId { get; set; }
 public string StateName { get; set; }

state acction

 public JsonResult getState(int id)
        {
            var state = client.GetState(id);           
            return Json(state, JsonRequestBehavior.AllowGet);
        }

View

@Html.DropDownList("Country", null, "Select Country", new { @class = "form-control", @onchange = "getState()" })
@Html.DropDownList("State", new SelectList(Enumerable.Empty(), "CityId", "CityName"), "Select city", new { @class = "form-control" })

JQUERY

I need the jquery code that can achieve this. Please help.




Filter selected date from calendar to display chart reading from database

2017-03-24T08:19:27.69-07:00

Hi guys, 
i would like to know how to Filter selected date from calendar to display chart reading from database using web application from visual studio aspx page
Is there a way to do it? 




Custom Namespaces

2017-03-25T02:57:40.19-07:00

Ok, I am having trouble calling a single variable inside the testNamespace.cs file.

string dir = "test";

Right now it is inside the class like so:

namespace testNamespace
{
    public class testNamespace
    {
        // Test string variable
        public string directory = "test";



        public testNamespace()
        {
            // Nothing

        }
    }
}

Is there an easy way to do this?




Password field returning empty

2017-03-24T18:06:18.58-07:00

Hi,

I have a website that allows users to register. On the registration form, the user is asked to fill in a password on 2 distinct fields, and upon attempting to post the data, i have requiredFieldValidators for both  textboxes, a regularExpressionValidator to ensure that the user inserts a minimum of 5 and a maximum of 20 alphanumeric characters, and finally a compare validator that makes sure the same password was inserted on both fields.

This generaly works as it should, preventing registrations without inserting a password, but sometimes, for a yet unknown reason, users are able to register without a password being saved nor sent via the confirmation email (the email goes straight to the form to capture the password and not the database).

I was able to contact one of the users that stated he was using a Safari (10.0.3) on MacOS Sierra (10.12.3).

Can someone explain me what is happening? is there an issue with Safari on MacOS that prevents capturing the password fields? I can't test it since i do not own a Mac...




TagLib-Sharp on a website (vb.net) (Type 'TagLib.File' is not defined)

2017-03-25T00:47:48.203-07:00

(Coding for VB.NET) I am working with the TagLib-Sharp. I really enjoy how it works. Very simple and straight forward. Well, within VS, it is, anyway. I took the files and placed them on my web server, of which included the BIN folder that VS created with the DLL files when I referenced the TagLib-Sharp.dll file. When I run the site through my browser, I get the following error. Type 'TagLib.File' is not defined I was told that I had to create a Namespace for it, so I did that. I also included all the IMPORTS for the different taglib's and that did not work. Here is the code that I am working with. default.aspx <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="TagLib._Default" %>
default.aspx.vb Imports TagLib Imports TagLib.IFD Imports TagLib.IFD.Tags Imports TagLib.Xmp Imports TagLib.Id3v2 Namespace TagLib Partial Class _Default Inherits System.Web.UI.Page Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load Dim mp3 As TagLib.File = TagLib.File.Create("G:\InetPub\wwwroot\Media\m.mp3") Dim strAlbum As String = mp3.Tag.Album Label1.Text = "Album: " + strAlbum mp3.Dispose() End Sub End Class End Namespace I also registered the DLL file with my system. %windir%\microsoft.net\framework\v2.0.50727\regasm G:\WebFiles\taglib-sharp.dll /codebase I also read about this error, where it deals with the .NET version that was used for the file and what the project is made with. I changed the version of .net down to 2.5 and then up to 3.5 and then back to 4.5 and it did not matter. Nothing seemed to work. (Other than a lot of errors when I went down to 2.5, it was a mess) But nothing seems to be working. Any idea's on this would be wonderful. Reading the mp3 metadata is something that I have been wanting to add to an ongoing project for many years. And I am this close, but cannot seem to cross that finish line. Thanks in advance for all assistance on this annoying issue.Carrzkiss [...]