Forms Data Controls :: Adding User Names When Updating GridView?

Sep 12, 2010

I'm using a windwos authentication via intranet. I'm able to display the username in a label control on a page load event (which is very simple).

I'm not storing this data anywhere in the table (MS SQL). I have all my data in a table and I'm using a gridview to diplay them. I'm using a button control to update all the rows in the gridview. I wanted to update three columns in the gridview (1. Tickbox, 2.Datetime Stamp and 3.UserId).

I've created a query in the dataset, through which i can update the Tickbox and DateTime stamp using now() function. But I'm not sure how to update the UserID field with the UserName (which inturn updates all the three fields in the gridview when the button is pressed.

View 2 Replies


Similar Messages:

Forms Data Controls :: Adding A Link Column To GridView With User's ID?

Aug 18, 2010

I have an accessdatasource that pulls several columns from my users table including [userID]. Then I have a gridview that displays all this information by autofilling the columns. Finally I have added a column that I want to link to viewUser.aspx?userID=####. The #### would of course be from the query.

Here's my column that I've added:

<Columns>
<asp:HyperlinkField datatextfield="View User"
datanavigateurlfields="userID"
datanavigateurlformatstring="viewUser.aspx?userID={0}"
headertext="Link"
target="_blank" />
</Columns>

This is my first time using this so I'm not sure what's wrong. I don't understand the '{0}' part and that's also where the problem lies. On the viewUser page when I print the querystring("userID") it just shows {0} as expected. How do I get my userID in there?

View 6 Replies

Forms Data Controls :: How To Get Gridview Field Names

Jan 17, 2011

I have a gridview that is dynamically created based off a csv file I'm importing.

Since I don't know what the column names are ahead of time, I can't pre format the gridview and use the "findcontrol" method to get the text value of the labels that are populated b/c I don't know the column names.

I know I can get the row index like this by iterating through the gridview...

[Code]....

but I'm not sure how to get the text value of the first column label? Not sure of the syntax?

View 2 Replies

Forms Data Controls :: How To Write The Column Names In Gridview

Jun 22, 2010

I want to write the default column names in gridview when the data is not coming from the dataset or you can say that datset is blank.

I tried to use this [Code]....

But this does not help me and i am not able to see the column with name as 'ID'

View 12 Replies

Forms Data Controls :: Finding AutoGeneratedColumn Names In GridView

Jan 11, 2011

I currently have a gridview that has autogeneratecolumns = true. Right now, I am trying to find all the column names of a given table. Since auto columns arent part of the columns collection, Grid.HeaderRow.Cells[i].Text does not work. I have also tried

[code]....

View 3 Replies

Forms Data Controls :: How To Display Foreign Key Names Instead Of Id In GridView

Jun 26, 2010

i want to display name of related table in my gridView insetad of it's id. one solution is using sqlDataSource or objectDataSource, but i don't want using this appproach. i want to do this without setting any dataSourceID or join tables, in other word, i want to do this like windows form datagridViewComboBoxColumn.

View 3 Replies

Forms Data Controls :: Display A List Of Names To Gridview?

Jun 28, 2010

i seem to have a problem with my gridview, i have a gridview with a list of names, this gridview is assign to a datasource and the datasource already has a select statement to display a list of names to my gridview, and i have a search dialog which i use to filter data to be displayed on my gridview, my problem iS after filtering , when a user select a certain row the gridview refreshes and display the initial data(it binds again the use the default setted select query). On my search i use

SqlDatasourceName.SelectedComman = filterQuery;
SqlDatasourceName.DataBind();
GridviewName.DataBind();

to filter the grid according to my search criteria, which is the one i have assigned its select to the string varieble filterQuery.

That works fine, and dispaly only d data i setted my search to retrieve, bt my problem is when a user select a row on d gridview , d gridview is repopulated with d initial data(Use initially datasource select statment). How to make d grid to stick to d select statement that i setted on my search and not letting it to go back to the initial setted select.

View 4 Replies

Forms Data Controls :: How To Get List Of File Names In A Directory Into Gridview

Jan 15, 2010

Suppose I have a folder inside the web application:-

applicationdatabase

In this folder there are 3 files
1.xls
2.mdf
3.jpg

How to get the 3 file names into a Gridview ?

View 3 Replies

Forms Data Controls :: Finding TextBoxes (without Using Their Names) In GridView (Edit Mode) Using TemplateField

May 3, 2010

I am using Asp:TemplateField in gridView. I have only ONE TemplateField as follows

[Code]....

I want to find all the textboxes (when grid row is in edit mode) using some kind of loop. I don't want to find the TextBoxes by their names like e.row.findcontrol("..");

I did Response.Write(e.row.controls.count), it show "2". How can I find textboxes without using names

View 5 Replies

Forms Data Controls :: How To Update Parent Gridview After Updating Child Gridview

Dec 14, 2010

I have a parent gridview which has a child gridview in the itemsTemplate. Both are binded to different SqlDataSources. I can successfully update and delete rows in the child gridview. After updating in the child gridview, some related data in the parent gridview are not updated automatically. So i have placed ParentGridview.Databind() in the rowupdated event of child gridview. But it doesnt look working.

How can i accomplish this?

View 4 Replies

Forms Data Controls :: Updating GridView Based On Computation In Another GridView

Jan 27, 2010

[Code]....

[Code]....

View 1 Replies

Forms Data Controls :: Updating GridView With GridView Columns That Are Readonly

Feb 20, 2011

I have a GridView with 5 fields. Only two of the fields are edittable (the others are READONLY).

I have an UpdateCommand as follows

<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:NHLPOOL %>"
SelectCommand="SELECT [PlayerID], [Firstname], [lastname], [Goals], [Assists], [Goals]+[Assists] as Points, [AsOfDate] FROM [PlayerStats], [Player] where [PlayerStats].[PlayerID] =[Player].[ID] ORDER BY Points DESC"
UpdateCommand="UPDATE PlayerStats SET Goals =@GOALS, Assists =@ASSISTS, AsofDate=GETDATE() WHERE PLAYERID = @PLAYERID">
</asp:SqlDataSource>

The issue is I want the PLAYERID GV column to be READONLY but I get a runtime error when updating if the PLAYERID is READONLY.

I get the error "

Must declare the scalar variable "@PLAYERID"."

View 1 Replies

Forms Data Controls :: Gridview Is Not Updating Anything?

Jan 28, 2010

I am using LINQ to SQL and on my DetailsView it updates fine but with my gridview it is not. Both I used template fields so I am not sure what the issue is?

[Code]....

[Code]....

[Code]....

I have been doing a lot of reading and searching and I cannot figure out why this is not working for me.

View 7 Replies

Forms Data Controls :: Updating Using Dropdownlist In GridView?

Feb 23, 2010

I was used TextBox in the GridView Then I Replace this textBox with Dropdownlist

and i fetched all the data from the database using DataSource in Editing Mode

But The problem is when i choose item from the dropdownlist to update it,it returns to Empty

(with No values) in the DropDownList??whats the problem?

[code]....

View 5 Replies

Forms Data Controls :: Updating A Cell In A Gridview

Sep 7, 2010

I have a gridview and I want to update a cell with a session variable username. In the Gridview1_RowEditing event I have this code :

GridView1.Rows(e.NewEditIndex).Cells(5).Text = Session("username")

It does not give me any errors and seems to work but the grid view cell do not take this session. When I'm clicking on the edit hyperlink this event is triggered.

View 5 Replies

Forms Data Controls :: Gridview Not Updating Record?

Jun 6, 2010

I am trying to update gridview record, i am not getting any error but its not updating the record either.

[Code]....

View 4 Replies

Forms Data Controls :: Updating All Rows In Gridview

Jul 30, 2010

Having a bit of difficulty working this gridview update problem out - I have managed to get edit/update function working but instead of only updating the current gridview row it is updating the whole table I believe this is due to a missing where statement on my Update statement - to single out the row index of my grid row.When I configure my sql datasource I am using custom statements Here is my update statement

UPDATE SimpData SET store_nbr = @store_nbr, date = @date, data_type = @data_type, acct_1 = @acct_1, amt_1 = @amt_1, acct_2 = @acct_2, amt_2 = @amt_2, acct_3 = @acct_3, amt_3 = @amt_3, cheque_nbr = @cheque_nbr, cheque_amt = @cheque_amt, gst_hst = @gst_hst, qst = @qst, comments = @comments, uploaded = @uploaded

Here is my gridview

<asp:GridView
ID="GridView1"
runat="server"
CellPadding="4"
Font-Names="Arial"
ForeColor="#333333"
GridLines="None"
Font-Size="Smaller"
Width="100%"
AllowPaging="True"
OnSelectedIndexChanged="GridView1_SelectedIndexChanged"
OnRowCommand="GridView1_RowCommand"
OnRowEditing="GridView1_RowEditing"
OnRowUpdating="GridView1_RowUpdating"
AutoGenerateColumns="False"
DataSourceID="SqlDataSource1"
OnRowDataBound="GridView1_RowDataBound">
<RowStyle
BackColor="#EFF3FB"
/>
<FooterStyle
BackColor="#507CD1"
Font-Bold="True"
ForeColor="White"
/>
<PagerStyle
BackColor="#2461BF"
ForeColor="White"
HorizontalAlign="Center"
/>
<SelectedRowStyle
BackColor="#D1DDF1"
Font-Bold="True"
ForeColor="#333333"
/>
<HeaderStyle
BackColor="#507CD1"
Font-Bold="True"
ForeColor="White"
Font-Size="Smaller"
/>
<EditRowStyle
BackColor="#2461BF"
/>
<AlternatingRowStyle
BackColor="White"
/>
<Columns>
<asp:ButtonField
ButtonType="Button"
CommandName="Select"
HeaderText="Select item to delete"
ShowHeader="True"
Text="Delete">
<ControlStyle
Font-Size="Smaller"
/>
</asp:ButtonField>
<asp:CommandField
ShowEditButton="True"
/>
<asp:ButtonField
ButtonType="Button"
CommandName="Select"
HeaderText="Select item to upload"
ShowHeader="True"
Text="Upload">
<ControlStyle
Font-Size="Smaller"
/>
</asp:ButtonField>
<asp:BoundField
DataField="store_nbr"
HeaderText="Store Number"
SortExpression="store_nbr"
/>...............

View 2 Replies

Forms Data Controls :: Updating A Row In A Gridview With A Dropdownlist

Oct 15, 2010

I have a gridview that holds 4 columns. in the fourth column there is a DropDownlist that holds three items.

I want my users to select one of the values and when they do the auto post back (which is set to true) should execute a method that updates the database selected row. But do i use the selectedindexchanged of the DDL or the Gridview? My head is totally thrashed so i imagine its really simple and im just over thinking it.

[Code]....

View 3 Replies

Forms Data Controls :: Refreshing Gridview After Updating?

Jan 20, 2010

i wanted to refresh the gridview once user enters values and clicks update button. But its not updating. If i change my selection to pop up gridview, then it is showing the updated values. I dont know where i am doing wrong. can any one suggest changes in my code?

[Code]....

View 2 Replies

Forms Data Controls :: GridView Not Updating Correctly?

May 14, 2010

I'm using a GridView to retrieve data from a stored procedure using a SQLDataSource (db is SQL Server 2008). When I compile my application and go to my website, all the data is loaded and shown fine. If I was to add a new entry to the table however (a seperate page on my website has a Wizard control to facilitate this) and then return to the page with the GridView, the new entry doesn't show up.

Looking from SQL Server, the data has been added, but the GridView isn't updating to show it. If I were to recompile the project with F6 and refresh the page, the new data will show up. I tried calling DataBind() on the GridView in the Page Load event, however the issue still remains.

View 5 Replies

Forms Data Controls :: GridView Edit Not Updating?

Sep 20, 2010

where I have gone wrong? changing from VS2003 DataGrid to VS2010 GridView; still on SQL Server 2000 so the wizards for autogenerating the code are not compatible.

Delete works, RowUpdating does not. I get an ArgumentOutOfRangeException on "rowToUpdate("QuoteDQty")
= Me.dgQuoteList.Rows(e.NewValues.Item(1).ToString)"
Private
Sub dgQuoteList_RowUpdating(ByVal sender
As Object,
ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs)
Handles dgQuoteList.RowUpdating
[code]...

View 2 Replies

Forms Data Controls :: Gridview Checkbox Not Updating?

Dec 14, 2010

i am trying to update my checkbox column in a gridview which i cont

I can able to get the data 1 or 0 in database and able to update the checkbox as checked or unchecked

my code is

<asp:TemplateField HeaderText="Available" SortExpression="Available">
<EditItemTemplate>
<asp:CheckBox Checked='<%# ConvertToBool(Eval("Available")) %>' Runat="Server" />
</EditItemTemplate>
<ItemTemplate>
<asp:CheckBox Checked='<%# ConvertToBool(Eval("Available")) %>' Runat="Server" />
</ItemTemplate>
</asp:TemplateField>

View 9 Replies

Forms Data Controls :: GridView Not Updating Value Correctly?

Feb 1, 2011

I have a GridView in ASP.NET. I have an Edit CommandButton for every line in the GridView to edit the data on that line. All of this works fine except for the fact that when the user clicks on Update, it does not update with the correct value that the user entered. I have this as a Template field with the textbox to edit bound to the field, so it updates when the user changed the value and clicks Update. However it does not work. I have tried almost everything and its very frustrating. Here is the code for the Data Source:

<asp:SqlDataSource ID="Table1DataSource" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString2 %>"
InsertCommand="INSERT INTO TABLE1(ProjectId, WBS, WBSTitle, VersionId) VALUES (@ProjectId, @WBS, @WBSTitle, @VersionId)"
DeleteCommand="DELETE FROM TABLE1

[code]...

View 3 Replies

Forms Data Controls :: Gridview With ObjectDataSource Not Updating?

Dec 17, 2010

I have a gridview with the ObjectDataSource and the Update does not work. When I click on Edit, I go to Edit mode but Update will not work at all. No errors. I do believe that it is in the RowUpdating method but cannot figure out how to call the method UpdateBook from the BookManager BAL.

BAL BookManager

[Code]....

Gridview

[Code]....

RowUpdating

[Code]....

Put in Breakpoints and it is getting to the RowUpdating but will not update.

View 11 Replies

Forms Data Controls :: Gridview Not Updating One Column In Row?

Feb 3, 2010

I'm trying to implement row editing on a gridview using a SQLDataSource, the updating works fine for all values in the row except for on value, Clock Reset Time. I have tried all sorts, tried converting to template fields, tried reordering columns, changing update query etc. I just cannot get the gridview to update the Clock Reset Time. here is the code.

[Code]....

View 5 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved