I uses asp.net listview control to display the details. Each item has the group details. For demo purposes group is hard coded.

I want to display the listview as shown below

enter image description here

Right now, I have this

enter image description here


    <asp:ListView ID="HyperLinkListView" runat="server" ViewStateMode="Disabled" ItemPlaceholderID="itemContainer" GroupPlaceholderID="groupContainer">
        <section class="quick-links">
            <div class="row">
                <div class="dfwp-column" style="width: 100%">
                    <div class="slm-layout-main groupmarker">
                        <ul class="dfwp-list">
                            <asp:PlaceHolder ID="groupContainer" runat="server" />
        <asp:PlaceHolder ID="itemContainer" runat="server" />
            <div class="item">
                <div class="link-item">
                    <asp:HyperLink Target="_blank" ID="hyperlink" NavigateUrl='<%# this.LinkToPlay((((SPListItem)Container.DataItem)["VideoFileName"]).ToString()) %>' Text='<%# Eval("Title") %>' runat="server" />
        <span>No data was returned.</span>

How do I achieve this?

I have the following, in a VS2017 asp.net Web Application using EF6:

            ipamuser _i = (from a in _de.ipamusers
                    where a.ipamuserID == _id
                    select a)
                    .Include(x => x.ipamuserapplications)
                    .Include(x => x.ipamuserclasses)
                    .Include(x => x.ipamuserdefault)
                    .Include(x => x.ipamuserecontacts)
                    .Include(x => x.ipamuserextlinks)

Everything returns fine, however, something strange is happening and I cannot seem to find the answer through google search (probably because I really do not know how to word it correctly)

What is happening is the parent object is being returned but with duplicate parent objects (i.e. ipamuser, ipamuser1, ipamuser2) and one of the children is being duplicated as well just like the parent (i.e. ipamuserapplication, ipamuserapplication1). This does not happen for every parent object, another parent only returns a single child object.

Also, when the duplication is occurring, there is only 1 record within the database for the child object.

Can anyone explain to me why this is occurring?

Here is my code

View (edit.ctp):

<?php echo $this->Form->create('Answer'); ?>
<?php echo $this->Form->input('Answer.0.value', array('class' => 'validate', 'type' => 'text', 'id' => 'Answer.0.id', 'label' => false)) ?>
<?php echo $this->Form->end('Edit Answer'); ?>


public function edit($id) {
    $this->layout = 'request_processing_edit';
    $data = $this->Response->findById($id);
    if ($this->request->is(array('post', 'put'))) {
        $this->Response->id = $id;
        if ($this->Answer->save($this->request->data)) {
            $this->Session->setFlash('Answer Editted');

This is how $this->request->data array looks like:

I need the id to be in the same array as value upon clicking submit in the view

Is there any way to achieve this without having to build the array in the controller? Looking for a way to have both id and value passed in the request upon clicking submit from the view/form.

Actually I load the picture on the server. But once we do this, the page refreshes. My goal is to do this without refreshing the page. How can I do that? Is there anyone who can help? In the code below I write onsubmit = "return false" in the form. But the picture is not uploaded to the server because the page is not refresh in this way.

    @using (Html.BeginForm("create_conference", "Home", FormMethod.Post, new { enctype = "multipart/form-data", id = "registerFormValidation", onsubmit = "return false" }))
                                                    @* image upload start *@
                                                    <div class="form-group">
                                                        <div class="input-group">
                                                            <span class="btn btn-default btn-wd btn-info btn-fill btn-file input-group-addon">
                                                                <i class="fa fa-image"></i> <input type="file" name="file" id="imgInp" accept="image/*">
                                                            <input type="text" class="form-control" readonly id="image-path" value="">
                                                    @* image upload end *@
                                                    <div id="enter-room-name">
                                                        <div class="form-group">
                                                            <input type="text" placeholder="Enter Name of Room" class="form-control" required="true" id="room-name" autocomplete="false" style="text-transform:uppercase">
                                                        <button type="submit" name="add-room-submit" class="btn btn-info btn-round  btn-wd">Save</button>

        public ActionResult create_conference(HttpPostedFileBase file)
            var path = "";
            if (file != null)
                if (file.ContentLength > 0)
                    //for checking uploaded file is image or not
                        || Path.GetExtension(file.FileName).ToLower()==".png"
                        || Path.GetExtension(file.FileName).ToLower()==".gif"
                        || Path.GetExtension(file.FileName).ToLower()==".jpeg")
                        path = Path.Combine(Server.MapPath("~/assets/img/conference-img"), file.FileName);
                        ViewBag.UploadSuccess = true;
            return View();
            //return Redirect("rooms"); 

I am facing with problem to set b2c authentication on MVC multi tenant application, where tenant is resolved by url http://app.name//{tenant}/{controller}/....

I set my own implementation of custom owin middleware, code bellow.

using AppFunc = Func, Task>;

public class MyMiddlewareComponent
    AppFunc _next;
    List<Client_ClientMain> _ccms;
    IAppBuilder _app;

    public MyMiddlewareComponent(AppFunc next, List<Client_ClientMain> ccms, IAppBuilder app)
        _ccms = ccms;
        _next = next;
        _app = app;

    public async Task Invoke(IDictionary<string, object> environment)
        //IOwinContext context = new OwinContext(environment);
        IOwinContext context = HttpContext.Current.GetOwinContext();
        string tenant = context.Request.Path.Value.Split('/')[1];

        _app.MapWhen(owinctx => IsTenant(owinctx, _ccms), _app2 => HandleDelegat(_app2, _ccms, tenant));

        await _next.Invoke(environment);

    private bool IsTenant(IOwinContext owinctx, List<Client_ClientMain> ccms)
        string tenant = owinctx.Request.Path.ToString().Split('/')[1];
        return ccms.Where(t => t.Name == tenant).Count() > 0;

    private void HandleDelegat(IAppBuilder ctx, List<Client_ClientMain> ccms, string tenant)
        Client_ClientMain ccm = ccms.Where(t => t.Name == tenant).FirstOrDefault();
        Client_ClientPolicy ccp = ccm.Client_ClientPolicy.FirstOrDefault();

        Config config = new Config();
        config.ClientId = ConfigurationManager.AppSettings["ida:ClientId"];
        config.ClientSecret = ConfigurationManager.AppSettings["ida:ClientSecret"];
        config.AadInstance = ConfigurationManager.AppSettings["ida:AadInstance"];
        config.Tenant = ConfigurationManager.AppSettings["ida:Tenant"];
        config.RedirectUri = ConfigurationManager.AppSettings["ida:RedirectUri"];
        config.ServiceUrl = ConfigurationManager.AppSettings["api:TaskServiceUrl"];

        B2CPolicyIdentifier b2CPolicyIdentifier = new B2CPolicyIdentifier();
        b2CPolicyIdentifier.SignUpSignInPolicyId = ccp.B2CPolicyIdentifierSignUpSignInPolicyId;
        b2CPolicyIdentifier.EditProfilePolicyId = ccp.B2CPolicyIdentifierEditProfilePolicyId;
        b2CPolicyIdentifier.ResetPasswordPolicyId = ccp.B2CPolicyIdentifierResetPasswordPolicyId;

        APIScope aPIScope = new APIScope();

        aPIScope.ApiIdentifier = ConfigurationManager.AppSettings["api:ApiIdentifier"];
        aPIScope.ReadTasksScope = aPIScope.ApiIdentifier + ConfigurationManager.AppSettings["api:ReadScope"];
        aPIScope.WriteTasksScope = aPIScope.ApiIdentifier + ConfigurationManager.AppSettings["api:WriteScope"];
        aPIScope.Scopes = new string[] { aPIScope.ReadTasksScope, aPIScope.WriteTasksScope };

        //StreamLineas.AzureAD.Startup startup = new StreamLineas.AzureAD.Startup(aPIScope, b2CPolicyIdentifier, config);


        ctx.UseCookieAuthentication(new CookieAuthenticationOptions());

            new OpenIdConnectAuthenticationOptions
                // Generate the metadata address using the tenant and policy information
                MetadataAddress = String.Format(config.AadInstance, config.Tenant, ccp.B2CPolicyIdentifierDefaultPolicy),

                // These are standard OpenID Connect parameters, with values pulled from web.config
                ClientId = config.ClientId,
                RedirectUri = config.RedirectUri + ccm.Name,
                PostLogoutRedirectUri = config.RedirectUri,

                // Specify the callbacks for each type of notifications
                Notifications = new OpenIdConnectAuthenticationNotifications
                    RedirectToIdentityProvider = (notification) =>
                        var policy = notification.OwinContext.Get<string>("Policy");

                        if (!string.IsNullOrEmpty(policy) && !policy.Equals(ccp.B2CPolicyIdentifierDefaultPolicy))
                            notification.ProtocolMessage.Scope = OpenIdConnectScopes.UserImpersonation;
                            notification.ProtocolMessage.ResponseType = OpenIdConnectResponseTypes.IdToken;
                            notification.ProtocolMessage.IssuerAddress = notification.ProtocolMessage.IssuerAddress.ToLower().Replace(ccp.B2CPolicyIdentifierDefaultPolicy.ToLower(), policy.ToLower());

                        return Task.FromResult(0);
                    AuthorizationCodeReceived = async (notification) =>
                        // Extract the code from the response notification
                        var code = notification.Code;
                        string Authority = String.Format(config.AadInstance, config.Tenant, ccp.B2CPolicyIdentifierDefaultPolicy);

                        string signedInUserID = notification.AuthenticationTicket.Identity.FindFirst(ClaimTypes.NameIdentifier).Value;
                        TokenCache userTokenCache = new MSALSessionCache(signedInUserID, notification.OwinContext.Environment["System.Web.HttpContextBase"] as HttpContextBase).GetMsalCacheInstance();
                        ConfidentialClientApplication cca =
                        new ConfidentialClientApplication
                        (config.ClientId, Authority, config.RedirectUri,
                        new ClientCredential(config.ClientSecret), userTokenCache, null);
                            AuthenticationResult result = await cca.AcquireTokenByAuthorizationCodeAsync
                            (code, new string[] { aPIScope.ReadTasksScope, aPIScope.WriteTasksScope });
                        catch (Exception ex)
                            //TODO: Handle
                            throw ex;
                    AuthenticationFailed = (notification) =>

                        // Handle the error code that Azure AD B2C throws when trying to reset a password from the login page 
                        // because password reset is not supported by a "sign-up or sign-in policy"
                        if (notification.ProtocolMessage.ErrorDescription != null && notification.ProtocolMessage.ErrorDescription.Contains("AADB2C90118"))
                            // If the user clicked the reset password link, redirect to the reset password route
                            notification.Response.Redirect("/" + ccm.Name + "/Account/ResetPassword");
                        else if (notification.Exception.Message == "access_denied")
                            notification.Response.Redirect("/" + ccm.Name + "/Home/Error?message=" + notification.Exception.Message);

                        return Task.FromResult(0);

                // Specify the claims to validate
                TokenValidationParameters = new TokenValidationParameters
                    NameClaimType = "name"

                // Specify the scope by appending all of the scopes requested into one string (separated by a blank space)
                Scope = $"openid profile offline_access {aPIScope.ReadTasksScope} {aPIScope.WriteTasksScope}"

The problem is when then even is know which tenant it is, app does not redirect on login page.

HandleDelagat works fine when it is use only for one tenant in Startup.Auth.

Can you advise or help?

I'm trying to extract data from a site on routes between different airports. The user is meant to pick two airports, then the program will show them all the different routes on a given day. Only, after searching for a route on the site, the URL changes to the same .asp domain name, no matter what route you are looking at. Is there a way to web scrape data from a specific route without knowing the URL, or is there possibly a way to obtain the true URL?

I am using ASP.Net Core 2 WepAPI controller.
Current version of Chrome(currently 64).
Angular 5 SPA.
Need to work on localhost.

This is controller method:

public class TestController : ControllerBase
    [HttpGet, Route("api/[controller]/test")]
    public async Task<IActionResult> Get()
        Response.Cookies.Append("testcookie", "testvalue", new CookieOptions
            Path = "/",
            Domain = "localhost",
            Expires = DateTime.UtcNow.AddHours(6),
            HttpOnly = false,
            Secure = false

        return Ok("Test Ok.");

And I don't think it matters, but this is my client code.

  private async test2() {
    const res = await this.http.get('http://localhost:59879/api/test/test').toPromise();

When I look in Chrome Console -> Network Tab -> the request line -> Cookies Tab; I see my response cookie(s) but no request cookie. I also do not see request cookie in HttpContext.Request.Cookies on subsequent requests.

How do I create any kind of cookie,

  • that is created server side, and returned from controller method,
  • and client/browser sends to server?

Assume server is on localhost:59879.

I have tried many iterations of setting the Domain to localhost,, false and excluding it. Tried not specifying CookieOptions at all, no Expires, and various combinations of HttpOnly and Secure settings to no avail.

These are some resources I have tried.

Update - I see a recent SO that may have the same cause of what I am experiencing.

I am working with laravel 5.0 and currently i am using PostController for communicating with two models

  • Post Model
  • Category Model

and i am using talking with models for database queries. Is this the good practice? or should i include the category model in post model and post model can also communicate with category model? where there is no category controller.

Please suggest the best practice for writing the methods which will communicate with database using models.

I have two textboxes in my create form. Both have user id's in it. Now I want to display the username of the user.

I have a form in which I select an imsi number. Right after selecting it the user to whom the sim was issued and to whom the sim is to be returned will be shown. Below is my code


  <?= $form->field($model, 'imsi')->hiddenInput()->label(false)?>

<?= $form->field($model, 'return_by')->textInput(\app\models\User::toArrayList()) ?>

<?= $form->field($model, 'return_to')->textInput(\app\models\User::toArrayList()) ?>

<?= $form->field($model, 'return_reason')->dropDownList(\common\models\SimReturn::simreturnReason()) ?>


jQuery('#the-sim-id').on('typeahead:selected', function (e, datum) {             
        var html = '<div class="selected-imsi"><input type="hidden" name="selected_imsi[]" value="'+datum.id+'" />'+datum.imsi+'<a onclick="$(this).closest(\'.selected-imsi\').remove()">X</a></div>';

The function toArrayList() is below

 public static function toArrayList(){
    if(Yii::$app->user->identity->user_role==Roles::ROLE_TEAM_LEAD && Yii::$app->user->identity->group_id != ''){
        return ArrayHelper::map(User::find()
            ->andWhere('id!='. Yii::$app->user->id)
            ->all(), 'id', function ($model,$defaultValue){
            return $model['username'].' - '.Roles::idToName($model['user_role']);
   else if(Yii::$app->user->identity->user_role==Roles::ROLE_SIM_MANAGER)
        return ArrayHelper::map(User::find()
            ->andWhere('id!='. Yii::$app->user->id)
            ->all(),'id',function ($model,$defaultValue){
            return $model['username'].' - '.Roles::idToName($model['user_role']);

    else if(Yii::$app->user->identity->user_role ==Roles::ROLE_PRODUCTION_MANAGER)
       return ArrayHelper::map(User::find()
              ->all(),'id',function ($model,$defaultValue){
           return $model['username'].' - '.Roles::idToName($model['user_role']);
    return ArrayHelper::map(User::find()->where(['user_type'=>'user'])->andWhere('user_role!=2')->all(),'id',function ($model,$defaultValue){
        return $model['username'].' - '.Roles::idToName($model['user_role']);

The above function gives me the username-role_name

Now when I open the form and selects an imsi number, then in textboxes I am only seeing the id's of the users and not their name.

enter image description here

I have two issues

  1. How to display the username instead of id
  2. How can I make the textbox read-only? as I have already tried ->textInput(\app\models\User::toArrayList(),['readonly'=>'readonly'])

But it says

Method call uses 2 parameters, but signature uses 1 parameters

Any help would be highly appreciated.

I need to monitor a status of a java process from a web page. I have a process running in a thread and perfoming some task periodically. In the page there is a status label showing "Running" or "Stoped". If i stop a process from another page, i should see that a status label value changes (refresh).

I have three .jsp pages on my app (index, user and admin). And I have three controllers for everything page but in my administration and user controllers use duplicate methods. For example, I have a method "getGenres" (For shows all genres from DB) in admin controller and user controller. How can I combine these methods if "@RequestMapping" is different in controllers?

public class AdminController {

private GenreTableService genreService;

@RequestMapping(value = "genres")
public ResponseEntity<Map<String, List<Genre>>> getGenres() throws ServiceException {

   Map<String, List<Genre>> genres = new HashMap<>(1);
   genres.put("genres", genreService.getAll());

   return new ResponseEntity<>(genres, HttpStatus.OK);

I am trying to get the id selected from a dropdown so that i can set it against my business logic method. I am using a repository pattern and my code is as follows.

However when i run the program, I get an error The insert statement conflicted with the foreign key.

Database Table

public class Item
    public int ItemId { get; set; }
    public string Title { get; set; }
    public decimal Price { get; set; }
    public string ItemArtUrl { get; set; }

    public int CategoryId { get; set; }
    public virtual Category Categories { get; set; }


Database table

public class Category
    public int CategoryId { get; set; }
    public string Name { get; set; }
    public string Description { get; set; }

    public virtual IEnumerable<Item> Items { get; set; }



public class ItemViewModel
    public int ItemId { get; set; }        
    public string Title { get; set; }
    public decimal Price { get; set; }
    public string ItemArtUrl { get; set; }

    public int CategoryId { get; set; }
    public IEnumerable<SelectListItem> CategoriesSelectListItem { get; set;}


public class CategoryViewModel
    public int CategoryId { get; set; }
    public string Name { get; set; }
    public string Description { get; set; }

Business Logic Layer

public class ItemBusiness : IItemBusiness
    public void Insert(ItemViewModel item)
        var itemrepo = new ItemRepository();
        Item i = new Item();
        i.Title = item.Title;
        i.Price = item.Price;
        i.ItemArtUrl = item.ItemArtUrl;
        i.CategoryId = item.CategoryId;

    public List<ItemViewModel> GetAllItems()
        var itemrepo = new ItemRepository();

        var query = (from x in itemrepo.GetAll()
                     select new ItemViewModel()
                         Title = x.Title,
                         Price = x.Price,
                         ItemArtUrl = x.ItemArtUrl,
                         CategoryId = x.CategoryId

        return query;


    public ActionResult Create()
        var categoryBusiness = new CategoryBusiness();
        ViewBag.items = new SelectList(categoryBusiness.GetAllCategories(), "CategoryId", "Name");
        return View();

    public ActionResult Create(ItemViewModel item)
        var itemBusiness = new ItemBusiness();


        return View();

    public ActionResult Index()
        var itemBusiness = new ItemBusiness();

        return View(itemBusiness.GetAllItems());

We developed a modular project in Laravel 5.1. There are lots of core modules and models that use these modules. In our case, if the inserted module uses other modules, it will be related to those models dynamically. When I remove the module from project by hand, I need to remove its dependencies from each module. We want establish relations without creating dependency between modules.

For example;

User model from account module used by other many other modules. Assume we have discussion module. When we build a relationship for discussion model, we can reach the user of the corresponding model. However, if we establish a relationship with the user model, this project will no longer be a moduler. We want to add dynamic functions to the user module from discussion module.

Temporarily, we add this code fragment to user module.

     * @return mixed
    public function lastAnswer() {
        if( class_exists( Config::get( 'account.models.discussion' ) ) ) {
            return $this->hasOne( Config::get( 'account.models.answer' ) )->latest();

        return null;

If the config file has a relation, we link it, otherwise it will not be linked or we will return null.

But we want to add this dinamically from discussion module rather than account module.

If we accomplish this, whenever we add or remove the discussion module from project, it will continue to run without problem.

We tried to add laravel macroable as a trait but we could't make it work in model files. It gives scope error.

For transformers files we are able to do this but in model files it didn't work.

I have an application where I want to change the navigation bar if a user is logged in.

<ul class="nav navbar-nav navbar-right">
     <p class="navbar-btn">
         <a href="#" class="btn btn-default">Winkelwagen</a>

             @if (@Model == null || Model.isSucces == false)
                  <a href="@Url.Action("Login", "Home")" class="btn btn-default">Inloggen</a>

                  if (Model.isSucces)
                        <a href ="@Url.Action("Login", "Home")" class="btn btn-default">Mijn Account</a>


So when I am logged in the program should go to the if in the else but it never comes so far.

Hope you guys can help me out.

below i mentioned our code for dropdownlist value get from database but i got error. error means in angular code not call angular http method url everthing so dropdown showing empty.


 $scope.product = function (e) {
            method: "GET",
            url: "/Prescription/GeneratePrescriptions"
          then(function (response) {
              $scope.formulationlist = response.data;
          }, function () {
              alert("Error Occur");


 public JsonResult TestFDAFormulation_Bind()
            DataSet ds = dFDA.Get_FDAFormulation();
            List<SelectListItem> Formulationlist = new List<SelectListItem>();
            foreach (DataRow dr in ds.Tables[0].Rows)
                Formulationlist.Add(new SelectListItem { Text = dr["Formulation"].ToString(), Value = dr["FormulationID"].ToString() });
            //ViewBag.MasterFormulationID = Formulationlist;
            return Json(Formulationlist, JsonRequestBehavior.AllowGet);

                                    <select ng-model="r.formulationid" ng-change="" ng-options=" p.formulationid as p.formulation for p in formulationlist" class="form-control">
                                        <option value="">Select Product</option>

Can anybody let me know with open XML structure

        <wp:inline distT="0" distB="0" distL="0" distR="0">
          <wp:extent cx="2143125" cy="2143125"/>
          <wp:effectExtent l="0" t="0" r="0" b="0"/>
          <wp:docPr id="2" name="1_1521835777" descr="/Images/DocumentImages/65429/0_15216260064632519_images.jpg"/>
            <a:graphicFrameLocks xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" noChangeAspect="1"/>
          <a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">
            <a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/picture">
              <pic:pic xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture">
                  <pic:cNvPr id="2" name="Picture 2" descr="/Images/DocumentImages/65429/0_15216260064632519_images.jpg"/>
                    <a:picLocks noChangeAspect="1" noChangeArrowheads="1"/>
                  <a:blip r:embed="rId7">
                      <a:ext uri="{28A0092B-C50C-407E-A947-70E740481C1C}">
                        <a14:useLocalDpi xmlns:a14="http://schemas.microsoft.com/office/drawing/2010/main" val="0"/>
                <pic:spPr bwMode="auto">
                    <a:off x="0" y="0"/>
                    <a:ext cx="2143125" cy="2143125"/>
                  <a:prstGeom prst="rect">

The ID and name of

<wp:docPr id="2" name="1_1521835777" descr="/Images/DocumentImages/65429/0_15216260064632519_images.jpg"/>

is maintained in all version of MS-Word [i.e 2010, 2013,2016].

I am sure about 2013 and 2016 but have a doubt on 2010. Is name and id os docPr placed inside the w:drawing maintained in all version of Ms-word?

I have an ascx user control that was used to show as modal popup using jquery in MVC4. I used the below code to get the data from controller and update the user control and show it as modal:

$("#ModalOpenLink").click(function () {
                type: "GET",
                url: "/Controller/ActionName",
                data: '{opkey: "' + 100 + '" }',
                contentType: "text/html, charset=iso-8859-1",
                dataType: "html",
                success: function (response) {
                failure: function (response) {
                error: function (response) {

The Popup itself contains some input fields through which it submits data. Now I just want to keep that Modal always open and refresh the popup content with the updated recent values.

Tried to return the Modal partial view but it just opening a new page and modal losts.

Here are the two action method used to render the modal content:

    public PartialViewResult FundDetails(string opkey)
        Opportunity opp = Opportunity.Get(opkey);
        opp.A = 100;
        opp.B = 200;

        return PartialView(opp);
    public ActionResult FundDetails(Opportunity opp)
        Opportunity oppUpdated = Opportunity.Save(opp);
        return PartialView(oppUpdated );

Please help.

I have two tables on my data base the first called "Students" which include information of the student and the second table called "Study results" which include the results of the student (the structure of each table is bellow)

==> table student

id_student || name_student || age_student || absence_student

==> table study result

id_result || id_student || subject_result || mark

I want that every student can be able to check his mark so I will give him a permission to only select from table "Study results" but I want also the student see only his mark not the mark of the other students something like [select * from Study results where idstudent=student_a]

can I do that ? I hope you can understand my question. Thanks in advance

I am very beginner in asp.net. Is there an easy way to see number of published commit (hash) on website. I have several versions of website published and I'd like to see on which commit particular published version is working.

Is there any easy way similar to [assembly: AssemblyVersion("1.0.*")] but displaying commit SHA instead of version number?

I have added records chosen (checkbox) in a datatable shown below, records have been displaying in a datagrid populated using stored procedure. Then on the button click I save all the selected (added) records to the ds in database.

public DataSet getMain()
        DataSet ds = CFObj.GetSchemaRequest();
        DataRow dr;
        dr = ds.Tables[0].NewRow();
        for (int i = 0; i < dgAvailableCandidates.Items.Count; i++)
            CheckBox saveChkBoxItem = (CheckBox)dgAvailableCandidates.Items[i].FindControl("chkbox_SelectCandidate");
            if (saveChkBoxItem.Checked)
                //ds.Tables[0].Columns["pk_scrndRecId"].ReadOnly = false;
                dr["pk_scrndRecId"] = "0";
                dr["fk_jobId"] = ddl_jobList.SelectedValue.ToString();
                obj._fkjob_Id = ddl_jobList.SelectedValue.ToString();
                dr["fk_recId"] = dgAvailableCandidates.DataKeys[i].ToString();
                obj._fk_recId = dgAvailableCandidates.DataKeys[i].ToString();

        return ds;

here my issue is when ds.Tables[0].Rows.Add(dr); i put outside of loop, it adds only one last selected record to ds, and when I put this inside loop, it throws following exception

[pk_scrndRecId] column is read only

and when I have placed this inside if block, it throws following exception:

This row already belongs to this table.

I am not able to understand why this code doesn't add all the selected rows of datagrid to the ds.

please help. thanks!

I have a relationship name "RELTYPE" with a property array called LineIds.


(node1) -[r:RELTYPE] -> (node2)

r.LineIds = [1,2,15]

I want to remove a very specific value from the r.LineIds Array(let's say 15).

The code written doesn't seem to work. I am trying to remove "15" from the r.LineIds array.

var lineId = 15
var match = "(t:Template)-[r1:DEPENDS_ON]->(e:Template)"
   .Where((Template t) => t.Id == this.source.Id && t.ScenarioId == sid1)
   .AndWhere((Segment e) => e.Id == this.dest.Id)
   .Remove(lineId+" In r.LineIds")

In Neo4j Browser

match (b :Template)-[r:Temp_Reffered_DIM_SEG1]->(dim2 :Natural_Account)
where b.Id = 228 and b.ScenarioId = 200 and dim2.Id =117
remove 15 in r.LineIds
delete 15

I have also tried [15] instead of just 15 in the remove. Nothing seems to work. Can anyone please help me with the syntax?