.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan
Post New Web Links

Edit users roles in gridview

Posted By:      Posted Date: September 14, 2010    Points: 0   Category :ASP.Net
 
I am trying to implement a page for an admin to edit other users details including roles and profile. I have a custom profile provider that stores data in database. My implementation is a page that shows username and allows an admin to reset user password, unlock users and approve and disapprove the users. I wanted to add a column in the gridview to allow the admin to remove or add a user to a role with the constraint that a user should be added only to one role.Any idea please?


View Complete Post


More Related Resource Links

Allowing Certain Users to Edit Certain Rows in a GridView

  
Here's my problem:    Different agencies are submitting projects to us, but I only want them to be able to edit their specific project (in addition, when they submit a project, they can only submit on behalf of their agency - but that may be a separate issue). Anyway, I can use the codebehind to show/hide the edit/delete/details buttons based on whether or not the user is authenticated using the following simple code in the Page_Init event:   If User.Identity.IsAuthenticated Then GridView1.Columns(0).Visible = True Else GridView1.Columns(0).Visible = False End If   To get what I want, though, I need to check each row (RowDataBound Event?).  The "SponsoringAgency" field will need to be validated against the user's credentials, and then the Edit button will be visible/invisible based on the result. Here's what I don't know how to do: 1.  When the user registers, have an additional field that asks and stores their agency information. 2.  I can't quite figure out how to get the SponsoringAgency value from the gridview.  I've tried a few tests using:   If e.Row.Cells(11).Text = "AgencyA" Then e.Row.Cells(11).Text = "TEST" End If   This does not work - the text isn't changed.  One of the possible problems is that I'm not sure I'm getting the right column in my grid

Inplace Edit in GridView

  
In this article I am presenting a different way to look at EditItemTemplate, using which user navigation for editing is reduced and . it looks very different (see screeen shots) then regular implementation of GridView.

Edit GridView Individual Cells in ASP.NET

  
The ASP.NET GridView allows for a row of data to be edited by setting the EditIndex property of the GridView, placing the entire row in edit mode.

You may not want the entire row in edit mode if you are using DropDownList controls for several columns in the EditItemTemplate. If each DropDownList has many options then loading them all at once may result in a sluggish page. Also, if your data structure is more like a 2 dimensional array rather than a set of rows, you may want to edit each cell individually.

Here I will demonstrate how to achieve this and also how to deal with event validation without disabling it.

ASP.Net Gridview Edit Update Cancel Commands

  
In ASP.Net 2.0, GridView Control also provides the functionality to edit and update the data retrieved from the database using CommandField template. You can cancel the action using Cancel Command of the CommandField. GridView consists of events that can be used to perform the actions like edit, update and cancel upon the Data items displayed in the ASP.Net GridView Data Control.

Edit Individual GridView Cells in ASP.NET

  
The ASP.NET GridView allows for a row of data to be edited by setting the EditIndex property of the GridView, placing the entire row in edit mode.

You may not want the entire row in edit mode if you are using DropDownList controls for several columns in the EditItemTemplate. If each DropDownList has many options, then loading them all at once may result in a sluggish page. Also, if your data structure is more like a 2 dimensional array rather than a set of rows, you may want to edit each cell individually.

ASP.NET GridView - edit records using JQuery Dialog

  
There are many ways in which you could modify modular data in Grid View:
1. Inline by making rows editable when u click on Edit
2. By using separate pages for Edit
3. By using popups/dialogs for adding/editing

Gridview Edit on Searching of Record

  

using Asp.net c#

sql server

i am searching a record from my database and displaying it in gridview now i want the comments should be updated as per the record which is being searched

For E.g if record No.3 is searched then only i can update record no.3 and i don't want rest of data to be shown


now what is happening when i click on edit my whole table is being displayed

this is bcuz i made one method gridfill() which i m calling everytime if i m doing grid row editing,row cancelling and row updating

how i can resolve this thing

my code

 protected void GridView2_RowEditing(object sender, GridViewEditEventArgs e)
    {
        GridView2.EditIndex = e.NewEditIndex;
        gridfill();

    }

 protected void GridView2_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        string id = GridView2.Rows[e.RowIndex].Cells[0].Text;
        TextBox t;
        t = (TextBox)GridView2.Rows[e.RowIndex].Cells[2].Controls[0];
        string query = "update user1 set comments=@comments where id=@id";
        SqlConnection con = new SqlConnection(connstr);
        con.Open();
        SqlCommand cmd = new SqlCommand(query, con);
        cmd.Parameters.AddWithV

How to let user edit selected gridview columns, not entire row

  

Hello!-

I've got a gridview I would like to let the user edit a couple of columns.  Seems like everything I'm coming across so far makes the entire row editable.  

Hopefully the solution isn't too complicated.  Can someone point me in the right direction?

 


LINQ with GridView and edit fields

  

My project includes a grid view which displays information of inventory items (Assets), data is quried from AssetTable. The GridView has a command field to allow editing, below is a description of the tables and how data is displayed

Tables

BuildingTable: (BuildingID, BuildingName)

AssetTable: (BuildingID,..,....,....)

 

ItemTemplate: Using a LINQ query I join the two table and displays in a label control a string which includes BuildingID and BuildingName (5 North Building)

 EditItemTemplate: Using a LINQ query I populate a DropDownList with strings of BuildingID and BuildingName same as above.
 
Here  issue which I need to resolve:
1.  ItemTemplate display the correct information (BuildingID BuildingName) but when I switch to EditItemTemplate the pair that is 
displayed is the first one on the list, how do I make is scroll to the item which was displayed in the label ?
 
 
 
<asp:CommandField ShowEditButton="True" >
                    <ControlStyle Wi

Add, Edit, update, Delete gridview

  
The article Add, Edit, update, Delete gridview was added by anjankant on Friday, July 09, 2010.

Thousandas operation we can do on Gridview control. Here I as explaining how we can add new recored and edit of existing record and delete a record in Gridview. Step1 : You can add this gridview in your aspx form. Here some events of Gridview are fired

jquery datepicker not popping up in Gridview Edit Template textbox

  

I have a gridview that I can't for the life of me get the datepicker calender to pop up for.  I've been using the datepicker for months very successfully for a variety of textboxes on the page and inside of formviews but this is the first time I've tried using with gridview.  I didn't expect any issues however can't seem to find anything to work.  I have searched the forums for 2 days and attempted any suggestions found within the solutions to no avail.  I've tried using the CSS to link the datepicker but everything stopped working when I changed the code and my page which uses a css style already got all distorted looking.  Please help!

Here is my gridview (only included a part b/c it is large and am only having problem with the datepicker for the date completed text box)

<asp:GridView ID="GridViewCompleted" runat="server" AllowPaging="True" AllowSorting="True"
        AutoGenerateColumns="False" BackColor="#CCCCCC" BorderColor="#999999" BorderStyle="Solid"
        BorderWidth="3px" CellPadding="4" DataKeyNames="job_id" DataSourceID="SourceJobProjectCompleted"
        ForeColor="Black" CellSpacing="2">
<Columns>

Multiple update statements per row in Gridview Edit

  

I want to set up a gridview that will display data like this

WeekEndingDate Project Category Sun Mon Tues Wed Thu Fri Sat
8/14/2010      proj1   test     2   1   2    3   2   1   0
8/21/2010      proj1   test     0   2   2    2   2   1   0
8/28/2010      proj1   test     0   1  

Gridview extends past edge of div and page when editing users

  

I have a gridview pulling all data from one user. This gridview has an edit button and when that is clicked the gridview becomes too wide for the div/screen and I get a scroll bar. Since this gridview can only have one user in it anyway is it possible to display each field on seperate lines instead?



Creating a gridview to allow editing of current users

  

I finally got membership and roles setup and seems to be working.

I have setup a page to allow the creation of a user and editing of roles for a user.

I would like to setup a page with a gridview that displays all users and what roles they are assigned. I remember running across someone else that was looking to do the same thing, but cant find it. Not sure if it was in this forum or online somewhere else.

But i found that i can use the  aspnet_Membership_GetAllUsers procedure in my db to get all the users, but how can i add the roles to each person and possibly setup the gridview so that each role they have, is displayed on their row in the gridview

So i would like to see something like this maybe more data displayed depending on the client request.

Username                 Email                 Last Login                          Roles

meofcourse               m

Edit gridview record on 2 rows

  

Hi,

Is that possible to edit a record within a gridview on 2 rows to make it look better when editing?

Like I have 8 columns in my gridview.

I wish to have 4 columns on row one and the 4 remaining columns on row 2.

Thanks!


Value into Textbox of GridView Edit

  
Hi there, I am not sure this can be done, and if not I am looking for an alternative. Before I start I am using VB.Net and ASP.Net.What I would like to do, is when the edit button is pressed on a Gridview row, I want the TextBox under the ClockOut column, to automatically have the selected value of a dropdown list at the top of the page. Basically so a list of users times will come up in the grid view, and as a fast way to insert a clock out time, the user will have to change the drop down list at the top of the ASP.Net page to the clock out time they want, then when pressing Edit on the row, the time from the Dropdown list will be in the ClockOut textbox, and pressing update will post this. Any help will be great! Thanks, Hope it can be done.

How to allow anyone to see the data, but only logged in users to edit it?

  
Hello,Don't know if this is documented anywhere, but I haven't found it yet.Let's say I want to allow anyone visiting a site to see the data. That's fairly easy as DD does this for you.However, I don't want just anyone to be able to edit the data. I only want selected people to be able to do that. I presume DD works with forms authentication as I've seen it mentioned, but I ahven't seen how to do it yet. Anyone able to give some pointers?Assuming that I've got authentication, how do I make it so that the public doesn't see an edit or delete link when viewing data?Thanks for any help
Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend