Title:
Not working for Dynamic Grid including gridcontrol
Name:
Sridhar
Date:
2013-01-05 2:05:56 AM
Comment:
Hi Mohyudhin,
Actually i tested this for my scenario and its not working when i try to add the grid control itself from code behind instead of declaring it in DOM(HTML). In that case the edit item template update and cancel button events are not firing.
Anybody faced similar issue?
|
Title:
ewrew
Name:
sdfdsf
Date:
2012-12-17 1:38:32 AM
Comment:
sfsdfds
|
Title:
zxxcx dcscdsfsccxdcsvsasdcxz
Name:
ax
Date:
2012-12-10 4:53:23 AM
Comment:
axzsxcszs
|
Title:
cvzvzv
Name:
vzvz
Date:
2012-12-10 12:58:58 AM
Comment:
vvvvv
|
Title:
Thanks Bro
Name:
Jayant Vengurlekar
Date:
2012-12-06 4:50:07 AM
Comment:
Hey Bro,
Hope you are doing good. Thanks very very much Bro. Nicely explained and clean code dude. Can you please help with (many have asked also) having a dropdown in the column. Would be of great help. Aprreciate your efforts bro. Thanks again Take Care Bro.
|
Title:
Edit button is not working
Name:
Sereyboth
Date:
2012-11-08 5:39:08 AM
Comment:
Hi,
I have followed your codes, but once I click on the Edit button, event onRowEdit of gridview doesn't fire at all. Then I decide to use AutogenerateEditButton of Gridview, but I can't get the control of the gridview after I click on updating. Can you please help me out? thanks a lot. my email is vsrboth@gmail.com
|
Title:
dfgdfg
Name:
dfgdfg
Date:
2012-10-25 8:08:28 AM
Comment:
dfgdfgdfg
|
Title:
Dropdownlist as EditTemplate
Name:
Ram
Date:
2012-06-19 4:11:52 AM
Comment:
Hi,
The sample code is simply great and also the explanation on the code was really very useful. But, I need further help on modifying the same code for adding dropdownlist control instead of textbox control as EditTemplate on clicking the Edit button for string data types.
Please help me with a sample source code on the above regards.
Thanks and regards, Ram Email Id: ramsai1973@gmail.com
|
Title:
Awesome code
Name:
Rounak
Date:
2012-06-06 3:13:32 AM
Comment:
Really awesome Work done,Keep on the great work
|
Title:
gridview update not working
Name:
saurabh
Date:
2012-05-25 6:09:22 AM
Comment:
i have created nested gridview template dynamically with the help of this article which is working perfectly with parent gridview but when i update inner gridview record,we are rebinding parent/child template again and then it will fire inner gridview 'rowcommand' event to update data. so in this case,it will lost the the data which i have entered in controls. so,what to do???? Please help me....
|
Title:
inception
Name:
inception movie poster
Date:
2012-04-26 3:20:06 AM
Comment:
inception is a 2010 science fiction action heist film which was written, co-produced, and directed by Christopher Nolan. The film features an international ensemble cast including Leonardo DiCaprio, Ken Watanabe, Joseph Gordon-Levitt, Marion Cotillard, Ellen Page, Tom Hardy, Cillian Murphy, Dileep Rao, Tom Berenger, and Michael Caine. DiCaprio plays Dom Cobb, a specialized corporate spy and thief whose work consists of secretly extracting valuable commercial information from the unconscious minds of his targets while they dream. Wanted for murder and unable to visit his children, Cobb is offered a chance to regain his old life as payment for a task considered to be impossible: "Inception", the implantation of an original idea into a target's subconscious.[5]
|
Title:
Domain name
Name:
Purchase domain
Date:
2012-04-18 2:45:10 AM
Comment:
Good work. Really you have described it very well. Keep up the great work... http://www.register-domainname.in
|
Title:
Mr
Name:
Yuvan
Date:
2012-04-11 1:00:35 AM
Comment:
Simply Superb!!! helped me a lot in learning . Many Thanks
|
Title:
Mr
Name:
Amiya Ranjan sahoo
Date:
2012-01-25 12:04:31 AM
Comment:
Hi i want from which content textbox and gridview but gridview also content textbox that data can be store in database.
|
Title:
mr
Name:
pradeep
Date:
2011-12-17 5:00:43 AM
Comment:
Hi Only a sugestion, have you check to see what kind of code generate your application? see specially the head label of the columnn of the datagrid. Maybe the solution cames from that direction.
|
Title:
Really nice
Name:
Bala
Date:
2011-11-15 4:23:32 AM
Comment:
As written in title a great sample u have given. Thanks a lot and keep on this:)
|
Title:
mer30
Name:
janatan
Date:
2011-10-08 12:50:07 AM
Comment:
THANK YOU FOR THIS SAMPLE
|
Title:
greate work
Name:
wangyang
Date:
2011-09-23 3:03:44 AM
Comment:
greate work!help me a lot!
|
Title:
Mr.
Name:
Jane
Date:
2011-09-07 8:17:09 AM
Comment:
Hello Mahr, I have one problem. If I clik the edit button means, the corresponding field must populate in the text box above the grid. Please explain how to do this.
|
Title:
To Mohyuddin
Name:
Jed
Date:
2011-08-21 9:44:21 PM
Comment:
Thanks for the Link.. I appreciate it very much..
|
Title:
VB.NET Version
Name:
Mohyuddin
Date:
2011-08-20 5:57:00 AM
Comment:
http://mohyuddin.blogspot.com/2009/08/dynamically-templated-gridview-with.html
|
Title:
Mr.
Name:
Jed
Date:
2011-08-20 4:51:31 AM
Comment:
is there a VB.NET Version of this?
|
Title:
thx
Name:
aisha
Date:
2011-08-15 4:28:57 PM
Comment:
thanks
|
Title:
Mr.
Name:
Dmitriy
Date:
2011-08-01 11:36:47 AM
Comment:
Hello Mahr! This article was very useful for me, but I was wandering about one problem I am having with this. If I insert a new record into the gridview, how to set the FOCUS to any particular text-field in this new record? Did you have this problem before and how to solve that? Your response will be apreciated. Thanks in advance. Dmitriy My email: dmitriy.mzhen@myfwc.com
|
Title:
A: Using this with a Dynamically Created Gridview
Name:
Jeff Bowman
Date:
2011-06-24 12:57:52 AM
Comment:
@Tony:
Pardon me, a correction. If you use AddHandler your GridView doesn't need to be a field; it can be a variable as you describe. You also don't need the Handles keyword.
HTH, Jeff
|
Title:
A: Using this with a Dynamically Created Gridview
Name:
Jeff Bowman
Date:
2011-06-24 12:54:17 AM
Comment:
@Tony:
=================================== Public Class SomePage Inherits Page
Private WithEvents gvSchedule As GridView
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load Me.gvSchedule = New GridView AddHandler gvSchedule.RowEditing, AddressOf gvSchedule_RowEditing End Sub
Public Sub gvSchedule_RowEditing(sender As Object, e As GridViewEditEventArgs) Handles gvSchedule.RowEditing '... Your code here ... End Sub End Class ===================================
HTH, Jeff
|
Title:
Q: Using this with a Dynamically Created Gridview
Name:
Tony
Date:
2011-06-15 7:19:58 AM
Comment:
Nice work Mahr!
This is a great solution. Can I ask a Q? I am using this to Dynamically create the entire GridView object. eg:
Dim gvSchedule As New GridView...
and then applying your Dynamic columns to it. But I'm not sure how I would reference a Dynamically created GridViews RowEditing, RowDeleting...etc Operations? Any suggestions?
Again, brilliant solution! Tony.
|
Title:
Solve Gridview Problem
Name:
Kalbaishakhi
Date:
2011-03-31 9:13:07 AM
Comment:
This is a very very nice and helpful article.
|
Title:
gridview
Name:
mita
Date:
2011-03-28 2:34:11 PM
Comment:
thank u very much for the code... searching dis code for days....
|
Title:
gridview
Name:
swapnl
Date:
2011-03-03 7:29:32 AM
Comment:
can u tell me about gridview edit coading
|
Title:
Dropdown List in Grid View while Editing
Name:
Archie
Date:
2011-02-28 8:06:19 AM
Comment:
Hey nice work.. can u explain how to get a ddl while editing a gridview ?? :)
|
Title:
Gridview edit problem
Name:
Hrithika
Date:
2011-02-24 4:38:35 AM
Comment:
I want to update only particular fields in my gridview,but when i click on edit entire row get selected...so hw to work with particular fields.. Thanx..
|
Title:
Alumini
Name:
SG
Date:
2011-01-27 8:22:44 AM
Comment:
Its nic
|
Title:
dropdown
Name:
kj
Date:
2011-01-24 11:17:48 PM
Comment:
how do i add dropdowlist in edititemtemplate and bind it to a datatable ?
|
Title:
HELP
Name:
Diego
Date:
2011-01-07 11:29:08 AM
Comment:
but... how I can validate a datetime in a gridview? ajax? javascript?
|
Title:
dropdown
Name:
King
Date:
2010-12-09 6:29:31 AM
Comment:
Hi, i want to make the first column a dropdown list how do i go about doing this. email:s21175056@tuks.co.za
|
Title:
Sorting and Paging
Name:
Nupur
Date:
2010-12-07 3:45:54 AM
Comment:
I had asked for help in sorting and paging. I have been able to implement.I am posting the solution incase somebody is in search for it. Create the grid in oninit. Add the follwing code. ItemTmpField.HeaderText = datatable.columns[i].columnname ItemTmpField.SortExpression = datatable.column[i].columnname
Dont add header template. Only Header text and sort expression. And implement gridview_sorting event.
|
Title:
Very Helpful
Name:
Nupur
Date:
2010-12-03 4:03:45 AM
Comment:
This article has been very helpful.Exactly what i was looking out for. How can we implement paging and sorting in this.
|
Title:
Displaying Headers when the DataSource is Empty
Name:
KingTiro
Date:
2010-11-19 8:23:44 AM
Comment:
thanx a million, but how do i display the buttons and the Headers when the Datasource is empty.For intial testing..my Database will be empty. email: s21175056@tuks.co.za
|
Title:
Not working with dropdown
Name:
Swapnil
Date:
2010-10-13 8:22:25 AM
Comment:
This Itemplate is not working with Dropdown item. Its works for insertion and deletion but while editing it does not show selected item.
|
Title:
RE
Name:
durva
Date:
2010-10-09 3:04:41 AM
Comment:
Excellent Article
|
Title:
gridview runtime updating, save inserting data,delete records
Name:
dharmendra yadav
Date:
2010-09-24 7:21:19 AM
Comment:
hello sir i am beginer in .net please give me an idea to improve me in this field....please solve my problem.
|
Title:
Insert dropdown
Name:
shrishail
Date:
2010-09-17 9:39:52 AM
Comment:
i want add dropdown and label inside the gridview. when i add together it gives me error. I have past my sample code snippest. DropDownList dd = new DropDownList(); dd.EnableViewState = true; dd.DataValueField = FieldName; dd.DataTextField = FieldName; dd.Text = FieldName;
private void OnDataBinding(object sender, EventArgs e) { object bound_value_obj = null; Control ctrl = (Control)sender; IDataItemContainer data_item_container = (IDataItemContainer)ctrl.NamingContainer; bound_value_obj = DataBinder.Eval(data_item_container.DataItem, FieldName);
string strsql = FieldName;
switch (ItemType) { case ListItemType.Item:
if (strsql == "dropdown") { DropDownList dd = (DropDownList)sender; dd.SelectedValue = bound_value_obj.ToString(); dd.Items.Insert(0, bound_value_obj.ToString());
dd.Items.Add(bound_value_obj.ToString());
//TextBox txtbox = (TextBox)sender; //txtbox.Text = bound_value_obj.ToString();
} else { Label field_ltrl = (Label)sender; field_ltrl.Text = bound_value_obj.ToString();
} break; case ListItemType.EditItem: TextBox field_txtbox = (TextBox)sender; field_txtbox.Text = bound_value_obj.ToString(); break; }
}
|
Title:
Allow Sort
Name:
Alex
Date:
2010-08-28 1:06:55 PM
Comment:
Is it works with sorting allowed?
|
Title:
Gridview
Name:
Ibrahim
Date:
2010-08-19 2:12:39 AM
Comment:
it is very useful to beginners. thanks a lot.
|
Title:
Datagridview
Name:
Sandeep Bhawsar
Date:
2010-08-11 8:27:33 AM
Comment:
Hi i use datatable to bind datagridview first time code run smoothly. when i update one row then only updated rows display in gridview, at the same time datatable have all rows present what is problem pls give me soln on sbbhawsar@gmail.com thanks
|
Title:
good
Name:
adel
Date:
2010-08-06 6:35:10 AM
Comment:
what about formview?
|
Title:
Query not updating
Name:
Stefano
Date:
2010-08-04 10:37:11 PM
Comment:
hello,
given that you made an amazing work im having problem updating a record with boolean value. The query set it to 0 when false and 1 when true. However i had to fit the code to work with Odbc should i change the values for true/false?
I also noticed the boolean fields, while in edit mode show a text box, how can i have em show a checkbox instead?
thank you,
|
Title:
Grid View record Display
Name:
M.K. dwivedi
Date:
2010-07-31 3:13:18 AM
Comment:
Grid View All record Display,But No Use For Event Programming Only Item Template or edit template Used this web site Solution Send My mail manoj.duvey@gmail.com
|
Title:
footer template not displaying
Name:
Ramya
Date:
2010-07-30 7:40:06 AM
Comment:
I have button in my grid. when i click that button. footer template shoul be displayed. i tried find control method to find the footer. the control is finding but footer is not displayed. how to solve it?
|
Title:
grid'viewer'
Name:
vishu
Date:
2010-07-26 7:57:22 AM
Comment:
u r viewer like imagination in hand
|
Title:
super
Name:
kumar
Date:
2010-07-24 10:44:17 AM
Comment:
u r excellent guiding to me.thak u
|
Title:
Solved Insert Problem
Name:
Manoj
Date:
2010-07-08 9:12:01 AM
Comment:
Thanks for ur code...thats insert in new row problem is solved!!
|
Title:
insert , update ,delete
Name:
Bablu
Date:
2010-06-19 12:26:46 AM
Comment:
Hi, I want, when i (insert or delete or update) in my form at that time change (insert or delete or update) in my gridview. can u please send me this code
|
Title:
update, edit, delete n insert in gridview
Name:
Nitu
Date:
2010-06-15 6:38:32 AM
Comment:
Hi,I want grid view edit,update and delete in C#.Net. plz send me in this emailid-nituwithu@gmail.com
|
Title:
edit, update, delete
Name:
Ali
Date:
2010-06-12 7:15:59 PM
Comment:
can u please send me this code
|
Title:
Edit,Update,Delete
Name:
vasudev
Date:
2010-06-12 6:11:59 AM
Comment:
Hi,I want grie view edit,update and delete in C#.Net. Is it possible.. please give the code my mail id is vasudev1985@yahoomail.co.in..
|
Title:
insert,update and delete code
Name:
jack
Date:
2010-06-01 10:59:33 PM
Comment:
hi I want Insert,Update,Delete Code in asp.net.show how to use that code send me on this id....jackpatel2586@yahoo.com as soon as possible.
|
Title:
problem if the datasource is empty
Name:
jimkalis
Date:
2010-05-28 10:25:29 AM
Comment:
Hi i want to ask if the datatable has no rows i want to display the header and let the user add records.How can i do that?
|
Title:
About Grid_view
Name:
Ganesh Atkale
Date:
2010-05-18 8:24:09 AM
Comment:
Hello I am Ganesh Atkale...please, tell me details about How to delete and update gridview link button...send code for it ...please I am very Thankfull to you.. my id is ganraj_atkale@yahoo.com
|
Title:
Handling Dynamic database
Name:
vaibhav
Date:
2010-05-13 8:05:03 AM
Comment:
vaibhav-It is very good code to learn session concept
|
Title:
Dynamically templated ListView
Name:
Frankie
Date:
2010-05-11 11:07:05 AM
Comment:
swapna - asked this a while back.. I didn't see an answer.. Sorry if I overlooked it concerning doing the same thing using the Listview.
Hi,
Thanks for the code. If you don't mind, Can you provide the code for dynamically templated ListView with Edit, Delete and Insert options.
|
Title:
programmer
Name:
chan
Date:
2010-05-04 8:11:22 AM
Comment:
THANK YOU....your post help me a lot in my development....
thanks again....
|
Title:
Regarding Gridview operations
Name:
Ganesh Atkale
Date:
2010-05-03 3:18:31 AM
Comment:
Thank you in Advance..... Regards --Ganesh Atkale
|
Title:
Superamma
Name:
Manoj
Date:
2010-04-27 3:38:23 AM
Comment:
High class amma le...sakhattagide...great work
|
Title:
run time insertion of row in gridview in C#
Name:
dharmendra
Date:
2010-04-25 7:54:14 AM
Comment:
please send me run time insertion of row in gridview in C# .cs code in my id dharmendra2008.306@rediffmail.com
|
Title:
run time insertion of row in gridview in C#
Name:
dharmendra
Date:
2010-04-25 7:52:46 AM
Comment:
please send the code of aspx.cs run time insertion of row in gridview in C#
|
Title:
data grid
Name:
neha
Date:
2010-04-23 3:16:51 AM
Comment:
database used in data grid and delete insert edit record in thge data grid
|
Title:
s
Name:
rahul
Date:
2010-04-07 1:28:19 PM
Comment:
please send me aspx.cs code for edit,update,delete & for insert operations.
|
Title:
request for demo
Name:
Rahul
Date:
2010-04-07 1:23:46 PM
Comment:
can u please tell us how to add item templates and all.
|
Title:
asdfg
Name:
vijay
Date:
2010-04-06 2:51:25 AM
Comment:
hello how r u?i wanna know that how it works
|
Title:
Request for changes
Name:
Sree
Date:
2010-03-24 9:44:58 AM
Comment:
Your article is good but it is having some problem that it is giving updation for all fields but i need to give ad and edit for certain fields only then how can i achieve this. Please tell me the solution and if possible give me code to my mail vsp2all@rediffmail.com.
Thanking you very much in advance.
|
Title:
partial page rendering
Name:
Raj kumar khatri
Date:
2010-03-17 3:30:31 AM
Comment:
when wew cahange the data in row or in specific cell automatically display the data in website without using refresh and timer if possible use ajax
|
Title:
Gridview
Name:
Venu
Date:
2010-03-09 7:51:41 AM
Comment:
Give detailes about Gridview with Examples for Beginners. send to venu.koornala@gmail.com
|
Title:
update data table
Name:
hidayah
Date:
2010-02-03 10:05:30 PM
Comment:
salam..
Refer my previous comment for insert and edit is successfully running, but i don't know how to do the update.The problem is, when user edit the data then the data will update in the data table without using query and adapter, just update the data in the data table. Below is my coding for update data table in row_updating:-
Dim kpi_id As String = DirectCast(GridView1.DataKeys(e.RowIndex).Value, String)
Dim dt As DataTable = DirectCast(Session("dt"), DataTable)
For i As Integer = dt.Rows.Count - 1 To 0 Step -1 Dim row As DataRow = dt.Rows(i)
If row("kpi_id").ToString() = kpi_id Then
GridView1.Rows(e.RowIndex).FindControl(dt.Columns(i).ColumnName)
End If Next
email: nor.hidayah@solutio-inc.my
|
Title:
Re: insert,edit,update and delete
Name:
Mahr G Mohyuddin
Date:
2010-02-03 3:54:34 PM
Comment:
wslaam. You can use ADO.NET diconnected model to submit changes once your finished with. You will have to change all queries accordingly, use DataSet , SqlDataAdapter to accept changes, finally to be save in database.
|
Title:
insert,edit,update and delete
Name:
hidayah
Date:
2010-02-02 11:48:08 PM
Comment:
salam.. i would like to ask u how to insert,edit,update and delete data in data table, then from data table update all changes to database.i use this template and assume this template gridview as data table.
email: nor.hidayah@solutio-inc.my
|
Title:
weird functionality 2
Name:
xt
Date:
2010-01-20 5:22:20 PM
Comment:
More to that I just found out that not always the edit command is sent, rather the command of the button in the same position in the item template to the one I pressed in the edititem template. That is, in the item template I have insert + edit + delete buttons, in the edititem template I have post + cancel buttons. When I press post insert is fired, when I press cancel, edit is fired. God I hate undocumented features.
|
Title:
weird functionality
Name:
xt
Date:
2010-01-20 5:08:27 PM
Comment:
Hi! Great example, helped a lot. I have a gridview templated not so differently. I initiated a new row for insert operations and it is hidden until I put the grid to edit mode with the insert flag on. When I press cancel or update in this particular row, an edit command is fired. In the browser I cannot see the markup for the cancel button, but it is showing up in the page. Chrome page explorer finds the correct markup for it, but still edit behavior is experienced. Anyone seen anything like that? I am quite nuts on this.
|
Title:
You Read THIS..................
Name:
DON
Date:
2010-01-20 4:31:10 AM
Comment:
You have not make any thing perfect.
|
Title:
s
Name:
tina
Date:
2010-01-20 4:29:13 AM
Comment:
very bad
|
Title:
grid view
Name:
sami
Date:
2010-01-13 10:22:39 AM
Comment:
it helpfull for me
|
Title:
GridView Dynamic
Name:
SHIVA
Date:
2009-12-23 4:07:34 AM
Comment:
IT's Helpful for me
|
Title:
Gridview Events
Name:
R.Devikarthi
Date:
2009-12-17 11:26:56 AM
Comment:
Very fine a.nd thanks for u
|
Title:
Mr
Name:
David Shochet
Date:
2009-12-02 11:29:37 AM
Comment:
In addition: in the same way if I delete a record and then refresh, the first record in the gridview is deleted, if I refresh second time, the next record is deleted, and so on: the previous action is repeated on refreshing.
|
Title:
Mr
Name:
David Shochet
Date:
2009-12-02 11:00:42 AM
Comment:
I have a problem. When I update a field and then refresh the page, it is trying to perform insertion thus causing an exception (duplicate record insertion attempt). Could you help me with this, please? Thanks.
|
Title:
Lokesh
Name:
lokesh
Date:
2009-12-02 8:06:00 AM
Comment:
tell me how to create rows with empty textboxes in gridview and my gridview is not connected to database table. reply ASAP
|
Title:
a simple programmer
Name:
Marian
Date:
2009-11-19 7:18:08 AM
Comment:
Hi, your sample it's complete. I use your sample for a test but the data are not show in the gridview. The columns are created but the data not. And i don't understand why. By logical point of view all it's correct . Can you help me ?
|
Title:
Validators
Name:
Rob
Date:
2009-10-28 3:37:16 PM
Comment:
Really liked your example on how to create a dynamic gridview. It was definately the best example that I could find. I was wondering if you have a solution on using validators. I have been able to add a required field validator in edit mode for my keys but I can not stop postback so the template is refreshed in item mode. I also tried to add a javascript validation method and tried to bind the onclick event to the method in the instatiatein method but this does not seem to work. No errors but it never fires.
Any ideas on how i can handle validation so it maintains the edit state would be much appreciated.
Thanks for the article it helped alot.
|
Title:
.NET Training Ahmedabad, PHP courses Ahmedabad, Web Design Training Ahmedabad
Name:
Shaishavi Sen
Date:
2009-09-23 6:31:47 PM
Comment:
We provide live projects with complete technical training for students studying in MCA, BCA, BE, PGDCA, MSc IT and other computer career oriented students providing them with Live International Projects
Website: http://www.dslacademy.com praful@dslacademy.com
|
Title:
.net Training Classes
Name:
Sharma Web Academy
Date:
2009-08-19 1:13:19 AM
Comment:
This code is helpful to me,, Thanks
.Net Training Classes Sharma Web Academy CONTACT US : harish.solanki@sharmainfoway.com
|
Title:
VB.NET version
Name:
José Mª Fueyo
Date:
2009-08-15 4:02:10 PM
Comment:
Hi Marh I see your comment after answer your mail. Thanks
Regards,
|
Title:
VB.NET version
Name:
Mahr G. Mohyuddin
Date:
2009-08-15 3:17:24 PM
Comment:
Hi Everybody,
For those who are looking for its VB.NET version please download it from my blog. http://mohyuddin.blogspot.com/2009/08/dynamically-templated-gridview-with.html
Regards, Mahr G. Mohyuddin
|
Title:
Hi Mahr G. Mohyuddin..
Name:
v.santhosh kumar
Date:
2009-08-01 9:24:39 AM
Comment:
your article is nice and works fine.. but when i press enter key, edit event doesn't gets fired..please help me
|
Title:
About GridView in asp.net
Name:
Vikram
Date:
2009-07-28 5:47:11 AM
Comment:
How to Add Dynamically Colums to GridView in c#
|
Title:
Validation controls
Name:
José Mª Fueyo
Date:
2009-07-23 11:20:21 AM
Comment:
Hi again Is it possible to add validation controls to the columns? How?
Regards,
|
Title:
Honor
Name:
Phil
Date:
2009-06-25 11:29:21 PM
Comment:
Very good work!
I've tried your module and it fits perfectly to what my present scenario... :)
Although I've added some extra functionalities (due to my system needs) to this module to meet our system goal, the basis of this building block is the key to achieve this versatile element is in greatly honor.
Many thanks!
|
Title:
SORTING SORTING SORTING SORTING
Name:
NGUYEN H. Thuc
Date:
2009-06-23 6:36:16 AM
Comment:
JUST IGNORE THE HeaderTemplate:
TemplateField tfSummary = new TemplateField(); tfSummary.SortExpression = "Summary"; //tfSummary.HeaderTemplate = new GridView_ItemTemplate(...); tfSummary.ItemTemplate = new GridView_ItemTemplate(...); tfSummary.EditItemTemplate = new GridView_ItemTemplate(...); tfSummary.HeaderText = "Summary"; gvDefect.Columns.Add(tfSummary);
THE CLASS GridView_ItemTemplate IMPLEMENTS ITemplate AND INamingContainer:
public class GridView_ItemTemplate : ITemplate, INamingContainer { }
I FOUND IT HERE:
http://webswapp.com/categories/ASPNET2/ITemplate/GridView.aspx
|
Title:
Sorting: To Jim H
Name:
José Mª Fueyo
Date:
2009-06-22 4:47:48 AM
Comment:
Hi Jim Only a sugestion, have you check to see what kind of code generate your application? see specially the head label of the columnn of the datagrid. Maybe the solution cames from that direction. Regards,
José Mª Fueyo
|
Title:
Sorting?
Name:
Jim H
Date:
2009-06-17 2:10:06 PM
Comment:
Any update or information on how to implement sorting?
Jim
|
Title:
How can I use an user control?
Name:
José Mª Fueyo
Date:
2009-06-16 12:08:57 PM
Comment:
Hi I am able to use standard controls with this sample,but I don't know how to use user controls. Can you help me,please? My idea is to use a date picker described at http://tinyurl.com/mrczap Thanks in advance. Regards,
|
Title:
For R Mathew: DropDownList
Name:
José Mª Fueyo
Date:
2009-06-16 12:05:28 PM
Comment:
Hi Rachel I pass a list delimited by "|" to a new property (string type). If the value is different of a sting.empty, then I separate each member of the string using the split method
If ListaDDL <> String.Empty Then 'Cuadro combinado Dim sLista() As String, i As Integer sLista = Split(ListaDDL, "|") Dim MiCombo As New DropDownList() MiCombo.ID = FieldName For i = 0 To UBound(sLista) Dim MiItem As New ListItem() MiItem.Text = sLista(i) MiItem.Value = sLista(i) MiCombo.Items.Add(MiItem) Next MiCombo.CssClass= "CuadroTexto" MiCombo.Text = String.Empty ' if Insert is intended no need to bind it with text..keep them empty If CInt(New Page().Session("InsertFlag")) = 0 Then AddHandler MiCombo.DataBinding, AddressOf OnDataBinding End If Container.Controls.Add(MiCombo) end if
Regards,
|
Title:
Re: Download don't Work
Name:
Mahr G. Mohyuddin
Date:
2009-06-16 10:16:40 AM
Comment:
Hi Juan,
Donwload issue is fixed.Please check it now.
|
Title:
example
Name:
meself
Date:
2009-06-10 9:11:55 AM
Comment:
nice article, but i cannot download the example.
When i click the link i get the message: Bad Request (Invalid Hostname)
can i download the example from anther location?
thx Jeroen
|
Title:
dotnet
Name:
prateek
Date:
2009-06-07 3:25:15 PM
Comment:
excellent
|
Title:
with drop down list and check bos
Name:
R Mathew
Date:
2009-06-04 9:08:13 PM
Comment:
Hi Jose,
Can you please share the modified code with drop down list? Thanks a lot in advance.
Regards, Rachel
|
Title:
Re: DropDownList: YES!
Name:
José Mª Fueyo
Date:
2009-05-28 4:05:04 AM
Comment:
Thanks, but the good job is your job :)
Thanks again for it!
|
Title:
Re: DropDownList: YES!
Name:
Mahr G. Mohyuddin
Date:
2009-05-21 6:30:25 AM
Comment:
Good job, Jose!
|
Title:
DropDownList: YES!
Name:
José Mª Fueyo
Date:
2009-05-21 5:51:37 AM
Comment:
Hi Very good proyect. I have translate it into VB.net, y modified it in order to use also dropdownlis. Nice, very nice... Thanks a lot!
|
Title:
Very complet sample
Name:
José Mª Fueyo
Date:
2009-05-20 12:03:58 PM
Comment:
Very good sample Is it possible to use others controls, for example DropDownList in order to edit or insert data?
|
Title:
Superb
Name:
Rameez
Date:
2009-04-28 7:54:25 AM
Comment:
A 1000000000000000 Thanks ...
|
Title:
Excellent article
Name:
Nishanth Nair
Date:
2009-03-31 9:23:37 PM
Comment:
Excellent Article. This is what I was searching for!! You rock!!
Nishanth
|
Title:
Exactly what i wanted!!!
Name:
Shabana
Date:
2009-02-14 1:58:13 AM
Comment:
Very nice article and exaclty what i wanted for my project!!!
|
Title:
first column primary key
Name:
Stan
Date:
2009-02-10 4:22:58 PM
Comment:
I have first column primary key and update not work.Where add "small code to check for primary key" ? so if work ? Thanks
|
Title:
HowTo: Retrieve row value
Name:
Shivan
Date:
2009-02-04 1:49:40 AM
Comment:
To retrieve row value , I used a loop to iterate till gridview.rows.count. But it returns count as 0.
how to handle this. Please Help
|
Title:
Dynamically templated ListView
Name:
swapna
Date:
2009-02-03 9:29:25 AM
Comment:
Hi,
Thanks for the code. If you don't mind, Can you provide the code for dynamically templated ListView with Edit, Delete and Insert options.
Thanks in advance Swapna
|
Title:
Events not firing when converted to Usercontrol
Name:
Paul Smith
Date:
2009-02-02 2:51:32 AM
Comment:
Mahr - thanks for the code it is awesome!
I am atempting to convert it into a usercontrol so I can reuse it much more easily in my application - but am not able to get any of the event handlers to fire when I click the edit/delete/insert buttons.
Is there anything I need to do from within the usercontrol to get these events to fire? I haven't changed much code, and can get it runnign if I simply do what you did and put it in a page.
Any hints or ideas?
Cheers
Paul
|
Title:
Edit/insert event not firing
Name:
swapna
Date:
2009-01-30 1:12:48 PM
Comment:
I have converted the above C# code into VB. Everything looks fine except the edit & insert buttons which are not firing the events. When i click on the edit button or insert button the edit_button_Click event or insert_button_Click event are not firing. please can u help me with this, it is very urgent.
Thanks
|
Title:
Not Able to add FooterTemplate
Name:
Sandeep
Date:
2009-01-25 5:01:33 AM
Comment:
Hi,
This code is very useful to me. Now I would like to add the FooterTemplate and added below code for the same.
In "defailt.cs" file
BtnTmpField.FooterTemplate = new DynamicallyTemplatedGridViewHandler(ListItemType.Footer, "...", "Command");
---------- In "DynamicallyTemplatedGridViewHandler.cs" file
case ListItemType.Footer: Literal footer_ltrl = new Literal(); footer_ltrl.Text = "Test....."; Container.Controls.Add(footer_ltrl);
break;
But, it is not displaying footer template in the page.
Thanks
|
Title:
Very good
Name:
Sandeep
Date:
2009-01-23 3:40:51 AM
Comment:
This helps a lot to implement my requirements. Thanks a lot. Two questions: 1) I would like to display two dropdowns in the GridView. Second dropdown needs to fill as per the selected value of first dropdown. 2) Want to display insert button only in the first row. How could I get the row index in the "DynamicallyTemplatedGridViewHandler"?
Thanks.
|
Title:
thanks
Name:
almny
Date:
2009-01-19 6:09:08 AM
Comment:
This bit of code was exactly what i was looking for and it's very helpful
|
Title:
Very helpful
Name:
nisha
Date:
2009-01-14 7:23:59 AM
Comment:
This bit of code was exactly what i was looking for and it's very helpful. Would it be easy to add the insert in the footer instead of as an edit item so that the it doesn't appear as if you are overwritting an entry?
|
Title:
auto edit button review needed
Name:
venkat
Date:
2009-01-02 2:32:08 PM
Comment:
Hi,
i have thousands of records in gridview. Imagine i have clicked the 450th records of autoeditbutton. it get auto postback and then changed to update button, So everything is fine.But what the problem is the user need to scroll down to 450th record to find it. Instead that selected record should be at the top of the gridview. so that he can easily find it and work on it. Is it possible in asp.net
|
Title:
Error Message
Name:
Ibrahim Yashar
Date:
2008-12-30 3:54:17 AM
Comment:
\ \
|
Title:
Error :DynamicallyTemplatedGridViewHandler
Name:
Amit mistry
Date:
2008-12-26 12:03:40 PM
Comment:
Server Error in '/Dynamically Templated GridView with Edit-Insert-Delete Options' Application
|
Title:
InstantiateIn
Name:
Ahamed
Date:
2008-12-19 6:28:41 PM
Comment:
hello, tks a lot, this is really what i need, but i didn't understood where the InstantiateIn is called and where this object System.Web.UI.Control Container is created. Can you explain please?
|
Title:
about (edit_button_Click) method
Name:
Armen Shatakhyan
Date:
2008-12-08 11:49:46 PM
Comment:
Now I find this method. Thanks a lot.
|
Title:
Re:about (edit_button_Click) method
Name:
Mahr G. Mohyuddin
Date:
2008-12-08 2:01:19 PM
Comment:
It's defined in class DynamicallyTemplatedGridViewHandler in App_Code as given below
//just sets the insert flag ON so that we ll be able to decide in OnRowUpdating event whether to insert or update protected void insert_button_Click(Object sender, EventArgs e) { new Page().Session["InsertFlag"] = 1; } //just sets the insert flag OFF so that we ll be able to decide in OnRowUpdating event whether to insert or update protected void edit_button_Click(Object sender, EventArgs e) { new Page().Session["InsertFlag"] = 0; }
|
Title:
about (edit_button_Click) method
Name:
Armen Shatakhyan
Date:
2008-12-08 1:10:17 PM
Comment:
Everything is fine. But what can you say about this string taht you have wrote edit_button.Click += new ImageClickEventHandler(edit_button_Click);
Where is this (edit_button_Click) method? I cant find it.
|
Title:
Dynamically Templated GridView with Edit, Delete and Insert O
Name:
Mike
Date:
2008-12-01 9:27:46 AM
Comment:
Excellent! Many thanks.
|
Title:
How to add template column(dropdownlist) in a gridview dynamically?
Name:
Amit
Date:
2008-11-27 9:29:09 AM
Comment:
How to add template column(dropdownlist) in a gridview dynamically?
|
Title:
add template column(dropdownlist) in a gridview dynamically
Name:
Amit
Date:
2008-11-27 9:28:23 AM
Comment:
add template column(dropdownlist) in a gridview dynamically
|
Title:
gridview
Name:
lalithashree
Date:
2008-11-17 5:56:34 AM
Comment:
hi i used edit button in gridview. when i click the edit button 2 buttons will be displayed update and cancel.... but when i click the edit button first time it is not firing but if i click for the second time then it is firing and showing the update and cancel button ....updation is working fine. but only thing is edit button is not firing for first click. pl can anybody help me in this
|
Title:
gridview
Name:
samantha
Date:
2008-11-17 5:37:49 AM
Comment:
when i am updating using gridview, the row is automatically getting deleted from the gridview. But when im checking the database, the row exists with the updated value.. can anyone help me out?
|
Title:
gridview
Name:
satish
Date:
2008-11-14 6:28:04 AM
Comment:
how to edit and delete in gridview
|
Title:
to count columns having a particular character in asingle row
Name:
uday kumar
Date:
2008-11-14 1:55:33 AM
Comment:
hi all, very nice article, this is very useful for my project. i am very new to programming, i am now in developing a project where i am come across a problem, that i want to view the attendance sheet of an employees which is viewed on gridview control with total days present and total days absent.
|
Title:
Dynamic Gridview Edit Template generation
Name:
Pratap Das
Date:
2008-11-03 3:36:05 AM
Comment:
Dear Friend,
Thanks you a lot, it helped me a lot a lot of times whenever I needed.
Pratap
|
Title:
Nice..
Name:
SL
Date:
2008-11-01 12:09:53 AM
Comment:
Can u tell me how we can delete a row from gridview directly without any delete query(Case: No database is given only through front end)
|
Title:
Awesome...this is the Standard
Name:
DS
Date:
2008-10-30 11:06:43 PM
Comment:
Very well organized article. If someone asks me to refer an article having so much comprehensive details and still wonderfully written, I would give link of this article. Thanks and it helped me a lot.
|
Title:
nice
Name:
JL
Date:
2008-10-15 2:30:45 PM
Comment:
GirdView does not support inserting a row in such a way. I have took leverage of Edit mode, (that always in-place) for inserting, therefore it looks it wipes out the row. yet you can have workaround for it. You may add and haeder div with columns above your grid and below and div for inserting row and then below it the grid itself with header invisible.
|
Title:
good
Name:
vijetha
Date:
2008-10-15 2:06:24 AM
Comment:
thanks for giving information
|
Title:
updating
Name:
subbu
Date:
2008-10-06 3:41:56 AM
Comment:
i hace gridview and this is not accept update command
|
Title:
Neatly Explained
Name:
Anu
Date:
2008-10-01 2:09:30 PM
Comment:
Thanks for nice illustration
|
Title:
creating delete button in grid using datasource
Name:
kamran
Date:
2008-09-26 3:07:30 AM
Comment:
if i bind my grid with a new data source. while creating there is an option called ADVANCED there u can generate delete, update and insert buttons now i have read that it only apply to those tables which had primary key right. now the problem is when i try this with the default created table which is aspnet_Membership this does not create any delete..... if u can help then thanx
|
Title:
Create rowupdate sub on runtime
Name:
oc666
Date:
2008-09-24 8:12:16 AM
Comment:
How could I create the subs of the gridview (rowupdate, rowediting, RowDeleting, etc) on runtime?
Thanks
|
Title:
Excellent Work
Name:
Ehtesham
Date:
2008-09-23 5:58:31 PM
Comment:
Excellent work done. Is there any one can make a video on the above titles. Congratulations!
|
Title:
Help
Name:
Castro
Date:
2008-09-16 9:19:40 PM
Comment:
Does anybody has an example how do I insert a checkbox in this grid?
Thanks in advance...
|
Title:
Very good (Muito bom)
Name:
Luciano Marcelino (Brasil)
Date:
2008-09-14 8:52:05 PM
Comment:
I do not speak your language very well, but I will try to show my satisfaction in seeing a job so well done. Congratulations!
|
Title:
date picker
Name:
Nilmar
Date:
2008-09-06 7:46:47 AM
Comment:
Does anybody knows how do I use a DateTimepicker in a grid?
|
Title:
ASP.net query
Name:
narayan
Date:
2008-08-29 6:34:48 AM
Comment:
hai sir, i have a problem in accessing data of a dynamically added textbox, how to get the data, when i click a button the data in the textbox must be saved in the database.
if possible please give me solution to this problem sir my email-id-knarayan8@gmail.com
|
Title:
Re: Gridview Insert Button At Top - WORKS!
Name:
Quang
Date:
2008-08-13 3:33:01 PM
Comment:
I was able to get it to work! Thank you. I had to do several things in case other people have the same needs. 1) add fields in the Header when case is "Command" 2) In TableGridView_RowUpdating You have to check whether its an Insert or Update session and then get the appropriate row. GridViewRow row; if ((int)Session["InsertFlag"] == 1) row = TableGridView.HeaderRow; else row = TableGridView.Rows[e.RowIndex];
|
Title:
Re: Gridview Insert Button At Top
Name:
Quang
Date:
2008-08-13 2:57:21 PM
Comment:
I was able to active the Add row button by setting the CommandName="Update". However, it's not finding the Header Row input control values. It's always getting the first data row values. Thanks.
|
Title:
Re: Gridview Insert Button At Top
Name:
Quang
Date:
2008-08-13 10:08:52 AM
Comment:
Is there a way to do add the "Add" row to the top while showing the Header? How would the user know what data corresponds to what fields?
|
Title:
Re: Gridview Insert Button At Top
Name:
Quang
Date:
2008-08-13 9:49:42 AM
Comment:
"You may add and haeder div with columns above your grid and below and div for inserting row and then below it the grid itself with header invisible. "
Do you mean to essentially - create another insert only GridView above the data GridView with only 1 top record. but default the mode to Edit (Insert)?
|
Title:
Re: how to use this with treeview
Name:
Mahr G. Mohyuddin
Date:
2008-08-13 7:30:05 AM
Comment:
Please check Table data member , you must reset it with the table you click on. i.e (quering , loading that table and assiging it to Table data member).
|
Title:
Re: Gridview Insert Button At Top
Name:
Mahr G. Mohyuddin
Date:
2008-08-13 7:12:02 AM
Comment:
GirdView does not support inserting a row in such a way. I have took leverage of Edit mode, (that always in-place) for inserting, therefore it looks it wipes out the row. yet you can have workaround for it. You may add and haeder div with columns above your grid and below and div for inserting row and then below it the grid itself with header invisible.
|
Title:
how to use this with treeview
Name:
Ramesh Rathi
Date:
2008-08-13 5:52:20 AM
Comment:
Hi,
i am binding all my tables to my treeview and when i click on one table this code is working correctly. When i am in the same session and trying to click on another table in my treeview the columnname still remains the columnname of my previous table but not the current one, can any one plese help me in doing this.
Regards, Ramesh Rathi
|
Title:
Gridview Insert Button At Top
Name:
Quang
Date:
2008-08-12 4:33:26 PM
Comment:
Is there a way to place the Insert Button at the top of the Grid View? From a usability perspective, when a user clicks on the current insert, it looks as if it wipes out the current row, but actually adds it to the bottom. Something like this.
http://69.10.233.10/KB/aspnet/InsertingWithGridView/3.gif
Thanks.
|
Title:
Griview_updating
Name:
chiru
Date:
2008-08-05 2:34:25 AM
Comment:
I have a problem in this code please try to solve my problem in gridview it is not updating it gives error as unable to cast the dat in update command so,please send reply to my email id . protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) { string sqlstat = ""; GridViewRow row=GridView1.Rows[e.RowIndex]; if (row != null) { Label lpub_id = row.FindControl("lblpub_id") as Label; TextBox t = row.FindControl("txtpub_name") as TextBox; DropDownList dcity = row.FindControl("ddlcity") as DropDownList; DropDownList dstate = row.FindControl("ddlstate") as DropDownList; DropDownList dcountry = row.FindControl("ddlcountry") as DropDownList; sqlstat = "UPDATE PUBLISHERS SET pub_name ='"+t.Text+"' , city ='" +dcity.Text+"',state ='"+dstate.Text+"',country ='"+dcountry.Text+"' where pub_name='"+lpub_id.Text+"'"; SqlConnection cn = new SqlConnection("user id=;password=;Data Source=.;Initial Catalog=pubs;Integrated Security=true;"); cn.Open(); SqlCommand cmd = new SqlCommand(sqlstat, cn); cmd.ExecuteNonQuery(); cn.Close(); }
|
Title:
Sorting
Name:
ravi
Date:
2008-08-02 1:34:17 AM
Comment:
How can i implement sorting in this gridview
|
Title:
Good Article
Name:
sajeeth
Date:
2008-07-17 5:05:31 AM
Comment:
AsI am Beginner I am able to follow.Fantastic Article to understand.Very much helpful to me.
May Allah will reward you for your work!!
|
Title:
Good
Name:
Suyash
Date:
2008-07-02 4:14:32 AM
Comment:
This is excellent article to understand 'how to use gridview with many data manipulation facilities dynamically'.Article gives the idea to work dynamically.
|
Title:
Re: CheckBox.CheckChanged not firing
Name:
Sean
Date:
2008-07-01 1:57:55 PM
Comment:
Problem solved via help in asp.net forums: http://forums.asp.net/p/1283521/2460080.aspx#2460080 Thanks again for the great article, Mahr!
|
Title:
Re: CheckBox.CheckChanged not firing
Name:
Sean
Date:
2008-07-01 7:42:29 AM
Comment:
Thanks for your assistance, Mahr. You'll see in my original post that: checkBox.AutoPostBack = true; I've run it in debug mode after putting a breakpoint in the Page_Load method of the page and verified that when I click a checkbox on the form that it auto posts back. Unfortunately, once the Page_Load method finishes, it returns without going into the DynamicGridViewCheckBox_CheckChanged event handler.
|
Title:
Re: CheckBox.CheckChanged not firing
Name:
Mahr G. Moyuddin
Date:
2008-07-01 12:44:58 AM
Comment:
Please confirm you have set its autopostback property to true. I dont think there should be such problem if its autopostback is enbaled.
|
Title:
CheckBox.CheckChanged not firing
Name:
Sean
Date:
2008-06-30 6:11:21 PM
Comment:
Many thanks for the excellent article. I'm having a problem with the CheckBox.CheckChanged handler not firing. As you can see, I have a DataBinding event as well - which is firing like it should. Could you give me some insight on why the CheckChanged event isn't firing?
public void InstantiateIn(System.Web.UI.Control container) { CheckBox checkBox = new CheckBox();
checkBox.ID = dataFieldName + "_CheckBox"; checkBox.EnableViewState = true; checkBox.DataBinding += new EventHandler(DynamicGridViewCheckBox_DataBinding); checkBox.CheckedChanged += new EventHandler(DynamicGridViewCheckBox_CheckChanged); checkBox.AutoPostBack = true; container.Controls.Add(checkBox); }
Thanks!
|
Title:
Insert data with new row.
Name:
Sohan Raj Gupta
Date:
2008-06-21 6:13:21 AM
Comment:
Hi,
Your code is Wonderful and it is very help full for create dynamic grid view.
I am creating a dynamic grid view. I use some parameter for create template field. For example 1 for Item, 2 for EditItem with textbox and 3 for EditItem with dropdownlist. It is run perfact in edit and update case. I have two main problem.
1) How I can get Id means identity field form database. This code give me only value field. But I want identity field for bind dropdownlist for DatatValueField. object bound_value_obj = null; Control ctrl = (Control)sender; IDataItemContainer data_item_container = (IDataItemContainer)ctrl.NamingContainer; bound_value_obj = DataBinder.Eval(data_item_container.DataItem, FieldName);
2) When I click on insert button then i have some problem. When I click on insert button then Item and EditItem with textbox(1 and 2 field) should replace with textbox and EditItem with dropdownlist(3 field) should replace with dropdownlist. But in this case there some problem EditItem with Textbox and dropdownlist replace by textbox and dropdownlist respectively and Item field not replace by textbox. So please help me and give me some solution.
Thanks in advance.
|
Title:
good approach
Name:
aditya
Date:
2008-05-29 2:00:01 AM
Comment:
i am trying to download entire source code for that.
|
Title:
mr
Name:
ch.krupakarreddy
Date:
2008-05-26 3:42:31 AM
Comment:
this is usefull for learning dot net
|
Title:
Dynamically Template column creation
Name:
Joggee
Date:
2008-05-23 7:44:00 AM
Comment:
I love your way of writing.
Wonderful Awesome.
Thanks alot. Joggee
|
Title:
Grid Format
Name:
Castro
Date:
2008-05-08 5:57:47 PM
Comment:
One more question:
How do I set alignment in a cell?(right or left) I´m really "BALD" trying to do this....
Thank´s in advance Please, save myself...
|
Title:
Excelent job
Name:
Horacio Grischinsky
Date:
2008-05-07 12:45:47 PM
Comment:
Just I need, now I am chaining this in a 3 layers object aerquitecture, when I finish it ,I promise, to send you a copy.
|
Title:
Re: Grid formatting
Name:
Mahr G. Moyuddin
Date:
2008-04-30 11:24:49 AM
Comment:
I am sorry for late reply. You may do that in following snippet of InstitateIn method. set textbox;'s width 100% that will fit to its container
TextBox field_txtbox = new TextBox(); field_txtbox.width="100% field_txtbox.ID = FieldName; ield_txtbox.Text = String.Empty;
|
Title:
Grid formatting
Name:
Nilmar P. Castro
Date:
2008-04-25 4:23:06 PM
Comment:
Is it possible to set a textbox width with the same column width?
How can I do that?
Your help will be greatly appreciated.
|
Title:
Mr
Name:
Nilmar P. Castro
Date:
2008-04-23 5:06:28 PM
Comment:
Excellent Article. But I´m having problems in change a Header Text, Font, and font-size. How do I? Can you help me? Congratulations
|
Title:
Session properties not instantiated
Name:
John
Date:
2008-04-22 12:46:27 PM
Comment:
Your GridView may be the perfect match for a project on which I am working. However, I am having trouble getting it to work. I have entered the server, user name, etc. into the text boxes, but when I click the Connect button, I get the following error in the btnConnect_Click event handler: NullReferenceException was unhandled when it hits the Session["Server"] line.
Here's the code in the event handler: protected void btnConnect_Click(object sender, EventArgs e) { msg_lbl.Text = ""; HttpContext.Current.Session["Server"] = server_tb.Text; HttpContext.Current.Session["UserName"] = user_tb.Text; HttpContext.Current.Session["Password"] = pswrd_tb.Text; etc.... Am I missing a "using" or a Reference or something in Global.asax? Your help will be greatly appreciated.
|
Title:
Thanks
Name:
Muhammad Afnan Khan
Date:
2008-04-21 5:07:37 AM
Comment:
You solved my Problem
|
Title:
VB version
Name:
error_Man46
Date:
2008-04-18 3:23:30 PM
Comment:
VB version = http://code.msdn.microsoft.com/DynamicTemplateClass
|
Title:
Rephrase
Name:
Mike-MD
Date:
2008-04-09 9:05:34 AM
Comment:
Mahr,
I understand. I understand exactly what you mean and do agree that you explained the ITemplate interface. I think you did a great Job nonetheless.
I forgot to add something. For those who need a VB equivalent, the msdn web site has directions to achieving this and it was a great help to me (it actually explains the whole process in VB) heres the link below:
http://msdn2.microsoft.com/en-us/library/0e39s2ck.aspx
|
Title:
Re: Inconsistencies
Name:
Mahr G. Mohyuddin
Date:
2008-04-09 6:22:05 AM
Comment:
Hi,
Mike and Ben, Thanks for your comments. Yes there might be inconisities in convetions I used yet i have explained ITemplate in begining, i.e the pupose of using it. I tried myself to keep it compact. Well there is always room to improve. I will try to more elobarate the things in near futue.
|
Title:
Bottom line, the code works if you can read it.
Name:
Ben-USA
Date:
2008-04-09 2:34:53 AM
Comment:
The bottom line is that the technique was shared. I just actually have a dynamic DataTable that is generated at runtime and his code worked well displaying the data on gridview.
|
Title:
Inconsistencies
Name:
Mike-MD
Date:
2008-04-08 4:06:32 PM
Comment:
Hi,
After reviewing your code, I successfully made a VB equivalent. I'd just like to point out that you have some inconsistencies in your naming conventions..(You interchange the names of your declared variables), which is somewhat frustrating. Further more, your descriptions of your methods and scenarions leading to them are (in my opinion)niether intuitive nor explained properly (i.e the need for creating a Handler for the imagebuttons in your class & also explaining why you are Implementing the Itemplate Interface for those who do not understand the concept of implementation). Your code goes on the general assumption that everyone reading this is an advanced programmer, which (relating to myself) was no the case at first when I saw this article (I was one of the people who shared in the frustration of trying to decipher certain idiomatic conventions that were not explained here).
Overall, I think you did a good job. But I urge you to try to explain certain things further.
|
Title:
You're Awesome
Name:
Ben-USA
Date:
2008-04-07 2:06:56 AM
Comment:
Wow. did I say wow? Well, this article is a wow. Thanks for the technique! Thank you!
|
Title:
Re: Edit,Delete in GridView
Name:
Mahr G. Mohyuddin
Date:
2008-04-02 9:39:28 AM
Comment:
No problem. You may contact me on my personal email address
|
Title:
Edit,Delete in GridView
Name:
Prasad
Date:
2008-03-31 6:47:47 AM
Comment:
I'm a fresher in Soft: Programming , Can u help me how to make Edit, delete functional in Grid View .
|
Title:
jafar
Name:
jafar
Date:
2008-03-28 10:45:45 AM
Comment:
hello how are you?
|
Title:
Grid starting in edit mode
Name:
Bob
Date:
2008-03-27 4:11:49 PM
Comment:
Hi, anyone else have this problem? I am unable to determine why the grid has started in edit mode (textboxes instead of labels). I want the ItemTemplate to be labels so they're not editable. Please help.
|
Title:
Re: VB Conversion?
Name:
Mahr G. Mohyuddin
Date:
2008-03-22 3:01:09 AM
Comment:
Can u please me the converted solution you have so far. I will make correction and will send to you.
|
Title:
VB Conversion?
Name:
CB
Date:
2008-03-21 2:56:50 PM
Comment:
Hi Mahr - Great Work! Thanks! Do you have a VB solution yet? I unsuccessfully attempted to convert this to VB. Still 12 errors left. Here are a few...
(1) insert_button.Click += New ImageClickEventHandler(insert_button_Click)
field_lbl.DataBinding += New EventHandler(OnDataBinding)
(2) 'add templated fields to the GridView Dim BtnTmpField As TemplateField = New TemplateField() BtnTmpField.ItemTemplate = New DynamicallyTemplatedGridViewHandler(ListItemType.Item, "...", "Command")
BtnTmpField.HeaderTemplate = New DynamicallyTemplatedGridViewHandler(ListItemType.Header, "...", "Command")
BtnTmpField.EditItemTemplate = New DynamicallyTemplatedGridViewHandler(ListItemType.EditItem, "...", "Command") TableGridView.Columns.Add(BtnTmpField)
|
Title:
How to make discussion forum in asp.net
Name:
Riya
Date:
2008-03-17 7:05:49 AM
Comment:
Sorry this is not related to ur article but I know u can help me out.I want to create Discussion forum page in my web site.but i dont know how to do,which control should i use, please guide me. Or if u have any link plese give me.
|
Title:
Re: How to include drop down list in one column while editing
Name:
Mahr G. Mohyuddin
Date:
2008-02-27 3:31:20 AM
Comment:
Ok. You have to clear previous rows from table before binding it again. In void PopulateDataTable()
|
Title:
Re: How to include drop down list in one column while editing
Name:
Riya
Date:
2008-02-27 1:28:24 AM
Comment:
Thanks i have completed with drop down list. I have copied ur code as it is but when i click on edit rows gets doubled means in table there r 4 rows,when i click on edit it shows 8 rows with repeated data.
|
Title:
Re: How to include drop down list in one column while editing
Name:
Mahr G. Mohyuddin
Date:
2008-02-25 2:16:29 AM
Comment:
sorry i m unable to post a long reply server is not supproting this. You can add dropdownlist or any other control only in InstaitateIn method. See default is TextBox object you may take Dropdownlist and handle databinding event accrodingly i.e. you have to set DataTextField, DatatValueField, DataSource properties and DataBind() method.
regards. Mohyuddin
|
Title:
hi
Name:
Nirali
Date:
2008-02-25 12:46:17 AM
Comment:
How to include drop down list in one column while editing
|
Title:
How to include drop down list in one column while editing
Name:
Riya
Date:
2008-02-22 8:13:55 AM
Comment:
Nice article.But How to include drop down list in one column while editing.Please send me this very urgent.
|
Title:
aa
Name:
aa
Date:
2008-02-19 6:23:07 AM
Comment:
Hi David, Can u please try this.
protected void insert_button_Click(Object sender, EventArgs e) { Page page = new Page(); page.Session("InsertFlag")=1; }
Let me know if u have still problem.
|
Title:
How to write coding for GridView Edit/Update button
Name:
K.Manjunath
Date:
2008-02-08 10:12:12 AM
Comment:
How to implement GridView in Edit/Update button for textbox and the same data should be deleted and enter the new data inserted in GridView.
|
Title:
How to implement delete,Add,edit
Name:
suga
Date:
2008-02-01 12:24:22 AM
Comment:
how to implement delete operation when we use delete button for text box and the same data should be deleted in gridview
|
Title:
How add a filter
Name:
Peter
Date:
2008-01-24 2:32:33 PM
Comment:
Thanks for your nice work! I am a new asp.net programmer. I am trying to add a DropDownList as a filter to select part or full table from another table.
I add following codes: string strCode = (string)Session["FieldSelected"];
SqlDataAdapter adapter = new SqlDataAdapter("Select * from " + TableName, Connection);
try {
if (strCode == "[ALL]") { adapter.Fill(Table); } else { DataView dv = new DataView(Table); dv.RowFilter = Table.Columns[0] + "=" + strCode; TableGridView.DataSource = dv; TableGridView.DataBind(); }
However, it did not work. Would you please give me some hints. Thanks!
|
Title:
Re: Nice Article & Sorting
Name:
Mahr G. Mohyuddin
Date:
2008-01-22 12:27:34 AM
Comment:
Thanks Hari! for your comments.
Diana! I will take care of this as soon as i find time. I will publish it after incorporating your suggestion. Thanks.
|
Title:
Nice Article, Very Impressive Presentation
Name:
Hari Krishnan
Date:
2008-01-22 12:21:03 AM
Comment:
Thanks Bhaaaiiiii.
|
Title:
How to implement the sorting
Name:
Diana
Date:
2008-01-21 4:29:06 PM
Comment:
The GridView control raises the Sorting event when a Sort button (a button with its CommandName property set to "Sort") is clicked, but before the GridView control handles the sort operation. This allows you to provide an event-handling method that performs a custom routine, such as canceling the sorting operation, whenever this event occurs.
So change the header by LinButton and then implement the GridView sorting method.
|
Title:
how to implement delete operation when we use delete button for text box and the same data should be deleted in gridview
Name:
meghna
Date:
2008-01-21 12:11:06 AM
Comment:
its very urgent
|
Title:
Datagrid
Name:
satheesh
Date:
2008-01-19 5:33:42 AM
Comment:
good share
|
Title:
How to implement the Sorting, Please help...
Name:
Frank
Date:
2008-01-17 3:52:09 PM
Comment:
I figure out by myself. In short, the literal does not make the HeaderText clickable, so it needs to use linkbutton instead inside the handler class.
In addition, inside the class, it also need to add a event handler for linkbutton click from where you can call gridview sorting function directly.
|
Title:
How to implement the Sorting, Please help...
Name:
Frank
Date:
2008-01-17 1:35:43 PM
Comment:
Thank you for your great article. I'm trying to make the header clickable in order to do sorting on each column, but failed.
Generally speaking, where is the place to add 'SortExpression = ColumnName'? I know it's not enough to just set AllowSorting="True" inside the gridview control. Thank you!
|
Title:
Re:Multiple User
Name:
Mahr G. Mohuddin
Date:
2008-01-17 12:05:30 AM
Comment:
Hi, You need to implement optimistic concurrency in your application to get rid of this problem in multi user environment. For this you need to keep a version field in the table being bound to the grid. It should be 0 by default (when record is inserted). Increment it while updating/deleting it. When you load in edit mode keep the version in viewstate or session or in some hidden field. Whenever it is refreshed or re-loaded match its new version with the one saved in session. if there is a mismatch you need to simply alert the user to show messages like "re-acces the record!" or if not found (deleted)show "record no longer exists!".
|
Title:
Multiple User
Name:
Harsh
Date:
2008-01-16 1:35:42 PM
Comment:
Hi,
This article was very helpful. However, it would not work in multi-user environment.
Say for instance, User A and B load the same page. User B deletes row # 5 while User A is still viewing the old data. Then User A clicks row # 7 for editing. When data refreshes on postback, User A sees that the row in edit state is not the one he/she selected (The orignal row #7 has now become row #6 as User B deleted a row and User A was looking at out-of-date data).
Can you suggest a workaround for this scenario?
Thanks.
|
Title:
How to Implemet the Sorting
Name:
Adnan
Date:
2007-12-19 12:56:57 PM
Comment:
Asalm Alikum I tried AllowSorting property to True and protected void TableGridView_Sorting(object sender, GridViewSortEventArgs e) { DataTable dataTable = GridView1.DataSource as DataTable;
if (dataTable != null) { DataView dataView = new DataView(dataTable); dataView.Sort = e.SortExpression + " " + ConvertSortDirectionToSql(e.SortDirection);
GridView1.DataSource = dataView; GridView1.DataBind(); } } but this code didnt work...the column header are not clickable... please advise and help..
|
Title:
Re: disable edit for selected rows
Name:
G. Mohyuddin
Date:
2007-12-14 7:28:30 AM
Comment:
W/slaam Since button for delete/insert/edit or any other control is added in InstatitateIn method that is called before databinidng.So no decision can be taken to on that time. If you are following my implementation you can try (i m not sure) to call InstatitateIn method once again after databinding and may add check here in following case adding the button for edit, and the key value can be set in some session vaiable. case "Button": // add an if statement here for check ImageButton edit_button = new ImageButton(); edit_button.ID = "edit_button"; edit_button.ImageUrl = "~/images/edit.gif"; edit_button.CommandName = "Edit"; edit_button.ToolTip = "Edit";
edit_button.Click += new ImageClickEventHandler(edit_button_Click); Container.Controls.Add(edit_button);
|
Title:
disable edit for selected rows
Name:
kashif
Date:
2007-12-14 6:35:07 AM
Comment:
asalam ,, i ve bind my gridview with a dataset, and has allowed auto generate edit to true, now for some of these rows i want to disable this ... how to achieve this,, it would be great if any one in the blob answes me
|
Title:
Re: Button Redirect
Name:
G. Mohyuddin
Date:
2007-10-03 12:36:53 AM
Comment:
Hi, Whenever a button is created in GridView and u want the fields info of the particular row in which it has been clicked, u must handle RowCommand event of the GridView. a little about it from msdn.
"The RowCommand event is raised when a button is clicked in the GridView control. This allows you to provide an event-handling method that performs a custom routine whenever this event occurs.
Raising an event invokes the event handler through a delegate. For more information, see Raising an Event.
The OnRowCommand method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class."
|
Title:
Button Redirect
Name:
Milton Almeida
Date:
2007-10-01 10:02:22 AM
Comment:
Hello, can you help me?
I read your article about gridview, it's very good and I'm using in my application. I created one button in gridview to show details in another page.
My problem is that I'm not meeting a way to click in this button, to catch the field key of gridview and to send it to another page.
Thank you, Milton.
|
Title:
How to Implemet the Sorting
Name:
Yaseen
Date:
2007-09-24 5:21:03 AM
Comment:
It is not working.should i need to implement Header as a link button? or what else
|
Title:
Re:How to Implemet the Sorting
Name:
G. Mohyuddin
Date:
2007-09-24 4:10:23 AM
Comment:
W/Slaam, Yasin Plz set AllowSorting property to True. and then handle the onsorting event in this way.
protected void TableGridView_Sorting(object sender, GridViewSortEventArgs e) { DataTable dataTable = GridView1.DataSource as DataTable;
if (dataTable != null) { DataView dataView = new DataView(dataTable); dataView.Sort = e.SortExpression + " " + ConvertSortDirectionToSql(e.SortDirection);
GridView1.DataSource = dataView; GridView1.DataBind(); } }
i hope it will work.
|
Title:
How to Implemet the Sorting
Name:
Yaseen
Date:
2007-09-24 1:10:15 AM
Comment:
Asalm Alikum G.Mohyuddin You have done a great job, but I want to Implement the Sorting what should I do? please help me. Thanks.
|
Title:
Re: Templated column
Name:
madval
Date:
2007-09-05 3:36:22 PM
Comment:
My mistake, reading my own post I see I was creating a new instance of the CheckBox control (checkbox = new CheckBox()) instead of checkbox = (CheckBox)sender
|
Title:
Templated column
Name:
madval
Date:
2007-09-05 3:33:04 PM
Comment:
First of all, thank you for your work, it's very nice. I'm trying to create a CheckBox templated column for a bit database field, I've read your post about it and I followed the steps you provided. The problem is that when the OnDataBinding event is fired and the CheckBox control is created it doesn't save its Checked and Text properties:
private void OnDataBinding(object sender, EventArgs e) { ...... case "CheckBox": CheckBox checkbox = new CheckBox(); checkbox.Checked = Convert.ToBoolean(bound_value_obj); checkbox.Text = bound_value_obj.ToString(); checkbox.Checked = true; //just testing break; ...... }
what do you think it's happening?
|
Title:
very nice work
Name:
pallawee
Date:
2007-09-03 4:45:56 AM
Comment:
very nice.i have learn a lot of thing about grid through ur article.
|
Title:
Gridview Events not firing.
Name:
GeneB
Date:
2007-08-29 5:52:51 PM
Comment:
Hi G.Mohyuddin
I have yet another question. None of gridview events are firing. I have all the "OnRow..." events setup in source code. I have the InstantiateIn method setup, though I changed the button from Image to Link. I can get the proper fields and data to show in the gridview, but when I click edit, it acts as if there is no data, though it keeps the caption. Anything you could tell me would be great.....
Thanks again,
Gene
|
Title:
Re: Session Object problem
Name:
G. Mohyuddin
Date:
2007-08-15 1:24:35 AM
Comment:
Please try this. and make sure you have added System.Web.UI namespace.
protected void insert_button_Click(Object sender, EventArgs e) { Page page = New Page(); page.Session("InsertFlag")=1; }
|
Title:
Session Object problem
Name:
GeneB
Date:
2007-08-13 2:32:32 PM
Comment:
Hi Mr. Mohyuddin,
Nice bit of code here. I have successfully translated it from C# to VB, but I am having a problem with the Session. I cannot refer to the session from my code in the App_Code folder. Any way around this?
Gene
|
Title:
Re: Needs the Checkboxex when the database field is Bit
Name:
G. Mohyuddin
Date:
2007-08-09 10:07:52 AM
Comment:
Hi Suresh, It is easy to add. just you have to see how TextBox and Label is being added in InstatiateIn method. Add a new condition for if InfoType="CheckBox" then make new instance of check box and add it like
Container.Controls.Add(checkbox); Also regiter its binding handlers like we have set for textBox and lable and bind it in its definition. Add it for both ItemTemplate and EditItemTemplate (for first set its enabled false)
Add these rows to add new column for it in constructor of the class in CreatTmpltdGrivView method as it has been called other coulmns. like
TemplateField CheckBoxTmpField = new TemplateField(); BtnTmpField.ItemTemplate = new DynamicallyTemplatedGridViewHandler(ListItemType.Item, "...", "CheckBox"); BtnTmpField.HeaderTemplate = new DynamicallyTemplatedGridViewHandler(ListItemType.Header, "...", "CheckBox"); BtnTmpField.EditItemTemplate = new DynamicallyTemplatedGridViewHandler(ListItemType.EditItem, "...", "CheckBox"); TableGridView.Columns.Add(CheckBoxTmpField);
|
Title:
Needs the Checkboxex when the database field is Bit
Name:
Suresh
Date:
2007-08-09 8:40:53 AM
Comment:
Hi Mohyuddin, Your Example Code is nice and helpful to the Developers. I need to display the checkboxes for a columnname(Status) and values (Active=1, InActive=0). Could you help me to overcome the problem.. It would be a greathelp for me...
|
Title:
Verynice
Name:
Mervin
Date:
2007-08-08 3:44:55 AM
Comment:
nice helpful for me thanks
|
Title:
Re: Foriegn Key fields
Name:
G. Mohyuddin
Date:
2007-07-25 1:14:32 AM
Comment:
It is possible to achieve that you need. What you have to do is add a 'case.'for "GrdiView" under second level switch statement in InstantiateIn method. When it will be claled implitely by the GridViewHandler contructor will add a GridView in ItemTemplate of the column instead of button , textbox or label etc.
public void InstantiateIn(System.Web.UI.Control Container) { switch (ItemType) { case ListItemType.Item: switch (InfoType) { case "GridView": GridView childGridView = new GridView(); childGridView.DataBinding += new EventHandler (OnDataBinding); Container.Controls.Add(childGridView); .....
then add the binding info in DataBinding event handler by introducing one swtich under ItemTemplate i.e.
private void OnDataBinding(object sender, EventArgs e) { ... ... switch (ItemType) { case ListItemType.Item: switch (InfoType) { Case "GridView" : GridView childGirdView = (GridView)sender; // now bind the gridView with appropriate datasource .....
} ...
In CreateGridView method add TemplateField (as already one has been added for Buttons) set its item,edititem and headertemplate through the gridviewhandler class contructor.
I hope it will work.
|
Title:
Foriegn Key fields
Name:
Neal
Date:
2007-07-24 10:57:16 AM
Comment:
How could you set up something so that cells that are foriegn keys would give you a gridview of the table that it is referencing(which you could then select an item to populate that cell)?
By the way I really think you have a great job here, it is really quite an elegant solution.
|
Title:
Foriegn Key fields
Name:
Neal
Date:
2007-07-23 4:40:38 PM
Comment:
How could you set up something so that cells that are foriegn keys would give you a gridview of the table that it is referencing(which you could then select an item to populate that cell)?
By the way I really think you have done a great job here, it is really quite an elegant solution.
|
Title:
Feed back
Name:
Abbas
Date:
2007-07-23 9:20:27 AM
Comment:
That is some better for understadning the Operations of gridview control.
|
Title:
Re: Brilliant
Name:
G. Mohyuddin
Date:
2007-07-12 12:59:30 AM
Comment:
Thanks, Fareeth. Alhamdulillah...All praises to Allah.
|
Title:
Re: briliant point pointed out
Name:
G. Mohyuddin
Date:
2007-07-05 8:31:32 AM
Comment:
Thanks Jon! I have tried my level best to let the developers know how to take maximum benefit from ITemplate interface.
|
Title:
briliant point pointed out
Name:
jon
Date:
2007-07-05 4:04:53 AM
Comment:
This line sure helps..
"It is important to know that the CommandName of insert_button is set to "Edit" just to take advantage of the Edit mode that provides text boxes for all editable items."
Great article, thanks.
|
Title:
Re: $ in the column name casuses problem
Name:
G. Mohyuddin
Date:
2007-07-02 3:07:35 AM
Comment:
Actualy the Eval method of DataBinder class calls GetValueProperty method which takes conatiner and the property name to return the value against it. Unfortuantely Eval method internally trims the name of property upto characters such as dot, dollar, hash, point etc. and passes to GetValueProperty that mismatches what is already in 'System.Data.DataRowView'.
Now the solution is we would call the GetValueProperty method direclty.
It is simple do the following.
In DynamicallyTemplatedGridViewHandler class the handler of OnDatabinding we have bound_value_obj = DataBinder.Eval(data_item_container.DataItem, FieldName);
chaange it with
bound_value_obj = DataBinder.GetPropertyValue(data_item_container.DataItem, FieldName);
It works fine.
|
Title:
$ in the column name casuses problem
Name:
Kiran
Date:
2007-06-30 12:50:39 PM
Comment:
I am developing a matrix which contains questions as columns. These questions may contain any characters. Currently i am facing problem when my column name contains "$". It works fine when there are no $ signs. "row.findcontrol" doesnot return anything as the "$" is trimmed from the ID which is given to the dropdown in the edititem. Which is why it is not able to find anything.
Can you tell me a workaround for this? Moreover are there any other characters which may cause problem
|
Title:
Re: disable the edit/delete button
Name:
G. Mohyuddin
Date:
2007-06-29 7:50:17 AM
Comment:
In InstaitiateIn method simply remove the code where button is being added. like it should not be there..
ImageButton edit_button = new ImageButton(); edit_button.ID = "edit_button"; edit_button.ImageUrl = "~/images/edit.gif"; edit_button.CommandName = "Edit"; edit_button.Click += new ImageClickEventHandler(edit_button_Click); edit_button.ToolTip = "Edit"; Container.Controls.Add(edit_button);
similarly remove code for delete button too.
|
Title:
disable the edit/delete button
Name:
Raj
Date:
2007-06-29 2:46:54 AM
Comment:
Hi, in .net datagrid i want to disable the edit/delete button.. the date row values wil be enable. if i yse this "Gridname.Enabled = false;" means all the datas og datagrid is disabled. but i want to disable the edit delete button only. how can i do that.
|
Title:
re: a question
Name:
Daivd
Date:
2007-06-28 8:48:16 AM
Comment:
hi,G. Mohyuddin thank you for ur reply, there is no problem on the code at all..
Really appreciate.
David
|
Title:
Dyamic Template with GridView
Name:
Alpesh Dhanesha
Date:
2007-06-22 7:42:59 AM
Comment:
Hi,
Thanks, but this not what i need. i need hierarchy of inner gridview. in which i have to create dynamic template columns. no need to edit template, just item template is required.
Waiting for reply Thanks a lot
|
Title:
Re: i want to add gridview instead of label
Name:
G. Mohyuddin
Date:
2007-06-22 7:22:33 AM
Comment:
You can use my other solution available at http://www.codeproject.com/aspnet/MultiNestMDGridview.asp You may add the child GridView in ItemTemplate instead of EditItemTemplate. And you can easily get Edting, Inertion simultenously.
|
Title:
i want to add gridview instead of label
Name:
Alpesh Dhanesha
Date:
2007-06-22 6:45:09 AM
Comment:
Hi, I want to add a N number of GridView in ItemTmplate like hierarchy of gridview. your code is very very helpful to me to develop it but i need more help.
Hope you help me on this topic Thanks
|
Title:
Re: a question
Name:
G. Mohyuddin
Date:
2007-06-19 1:13:38 AM
Comment:
Hi David, Can u please try this.
protected void insert_button_Click(Object sender, EventArgs e) { Page page = new Page(); page.Session("InsertFlag")=1; }
Let me know if u have still problem.
|
Title:
a question
Name:
David
Date:
2007-06-18 3:33:39 PM
Comment:
Hi, G. Mohyuddin, Thanks a lot for ur code, it really helps a lot.
Now, I am trying to convert ur code into VB version, but I got confused by some parts:
for example: in C# protected void insert_button_Click(Object sender, EventArgs e) { new Page().Session["InsertFlag"] = 1; }
after I transfer it to VB, I got: Protected Sub insert_button_Click(ByVal sender As Object, ByVal e As EventArgs) New Page().Session("InsertFlag") = 1 End Sub
But I got error message in the visual studio, it said "syntax error"
New Page().Session("InsertFlag") = 1 It seems this line is not correct.
I don't know what's wrong, since I am not familiar with C#, if u can tell me how to transfer this part, I really appreciate.. Thanks.
|
Title:
Re: Validate Fields
Name:
G. Mohyuddin
Date:
2007-06-14 10:07:47 AM
Comment:
Sure you can do it in code. you have to add the validator in InstantiateIn method for the text box. But make sure your all fields require it or add a condition based on the id of the field. then add it for example the in the last part of InstantiateIn where A TextBox is being instaitated add validators like this.
TextBox field_txtbox = new TextBox(); field_txtbox.ID = FieldName; RequiredFieldValidator rfv = new RequiredFieldValidator(); rfv.ControlToValidate = field_txtbox.ID; rfv.ErrorMessage = "This field cant be empty!"; rfv.Text = "!";
// dont forget to add both text box and the validator in the container as follows
Container.Controls.Add(field_txtbox); Container.Controls.Add(rfv);
Hope it works.
|
Title:
Re: Empty Table Proble
Name:
G. Mohyuddin
Date:
2007-06-14 9:42:38 AM
Comment:
Hi Rajesh! The default behaviour of GridView is that there must be at least one row in table to make table displayable. You have noticed that Insert option like Edit and Delete is in each row. Hence if there is no row there will be no Insert/Delete/Edit option. And even if i provide Insert button globally, there must have been at least one empty row to be filled i.e. is not supported by GridView. There are workarounds for it but they deviate from the core intention of the solution. You may add a fake row in table and do all insertion from GridView and later delete that row. -:)
|
Title:
Validate Fields
Name:
AR
Date:
2007-06-14 8:02:42 AM
Comment:
Is this possible to validate text box fields while inserting or updating (for example date field)
|
Title:
Empty Table Proble
Name:
Rajesh
Date:
2007-06-14 4:47:51 AM
Comment:
Hi Mohyuddin! i read the article it was great. i have one issue in this. When am opening a table which doesnt have any values. i cannot see any structure of insert,delete and update. it'll be nice that we can add data even if the table is empty. do u have any idea on this? pleas reply
|
Title:
Re: multiple Select
Name:
G. Mohyuddin
Date:
2007-06-04 5:41:26 AM
Comment:
Although updating multiple rows depends upon the WHERE clause in GenerateUpdateQuery method but the GridView control enters into edit mode only for single row. So it is impossible to open multiple multiple rows for editing.
|
Title:
multiple Select
Name:
biren mohanty
Date:
2007-06-02 12:50:50 AM
Comment:
thanks for this codeing for grid view updateing. but one problem that can we edit at a time multiple row.that means suppose I want to edit multiple rows without updateing after that when I click update button then all rows will be update.if u know then pls send me.
|
Title:
Re: OnDataBinding error
Name:
G. Mohyuddin
Date:
2007-05-25 1:27:58 AM
Comment:
Actualy the Eval method of DataBinder class class GetValueProperty method which takes conatiner and the property name to return the value against it. Unfortuantely Eval method internally trims the name of property upto ponit(.) and passed to GetValueProperty that mismatches what is already in 'System.Data.DataRowView'. Now the solution is we would call the GetValueProperty method direclty. It is simple do the following. In DynamicallyTemplatedGridViewHandler class the handler of OnDatabinding we have bound_value_obj = DataBinder.Eval(data_item_container.DataItem, FieldName);
chnage it with
bound_value_obj = DataBinder.GetPropertyValue(data_item_container.DataItem, FieldName);
It works fine.
|
Title:
OnDataBinding error
Name:
mikey
Date:
2007-05-23 9:37:03 PM
Comment:
ive created a datatable which has a column header of ranged numbers like "0.00 - 9,999.00" and "1,000.00 - 4,999.00". when i try to run the code i get the following error message:
DataBinding: 'System.Data.DataRowView' does not contain a property with the name '0'. 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.Web.HttpException: DataBinding: 'System.Data.DataRowView' does not contain a property with the name '0'.
Source Error:
Line 663: Control ctrl = (Control)sender; Line 664: IDataItemContainer data_item_container = (IDataItemContainer)ctrl.NamingContainer; Line 665: bound_value_obj = DataBinder.Eval(data_item_container.DataItem, FieldName); Line 666: Line 667: switch (ItemType)
it seems the ondatabinding event handler is unable to recognize the column name "0.00 - 9,999.00" and "1,000.00 - 4,999.00".
any help will be greatly appreciated. :)
|
Title:
Re: Stack Overflow
Name:
G. Mohyuddin
Date:
2007-05-22 6:16:53 AM
Comment:
Can u please show the code under onRowUpdating Event. So i will be better able to tell you what's happening.
|
Title:
Stack Overflow
Name:
Tinu
Date:
2007-05-22 5:06:17 AM
Comment:
I'm getting Stack Overflow exception while updating records. Please help me through this.
|
Title:
Re-GridView - Updating event is not fire
Name:
G. Mohyuddin
Date:
2007-05-15 12:00:01 PM
Comment:
My apologies for late reply. Actually in Page_PreInit event if the request is a postaback then the data has not ben yet laoded from view state therefore it update event will not be successful. use Page_Load event , till this event the control properties have been populated from view state and it does work successfullly. Hope it will work.
|
Title:
GridView - Updating event is not fire
Name:
Rahul
Date:
2007-05-10 1:14:07 AM
Comment:
Hey, Thanks for your nice article. I am facing some problem on grdiview. Please help me in this.
scenerio is :
Gridview Item, Header , EditItem field are populated on runtime. I am using ITemplate for this purpose. Everything is fine.
Problem: 1. When I am going to open a particular record in Edit mode, record is open as expected but Uppdate Event is not firing. I am creating GridView on Pre_Init Event.
2. Sometime I am also getting Viewstate problem.
Please Help me .
Regards, Rahul
|
Title:
re:MultiLine textbox mode add issue
Name:
Nomd
Date:
2007-05-05 11:45:13 AM
Comment:
I response my own question, It does work. I got it fixed. thanks
|
Title:
MultiLine textbox mode add issue
Name:
Nomd
Date:
2007-05-05 11:30:07 AM
Comment:
Hi Mohyuddin, I tried to add this line into hander field_txtbox.TextMode = TextBoxMode.MultiLine; field_txtbox.Height = 100; seems like it desn't effect anything in gridview. why?
|
Title:
Re: Exception in getting TextBox
Name:
G. Mohyuddin
Date:
2007-05-05 1:50:42 AM
Comment:
Hi, Thanks for using the solution. It shows that the FindControl method is returning null. Either there is no TextBox against the name of Column[5] or there is wrong column name. Check the column name while debugging and ensure that while creating templates this column was instiatated in TexBox.
|
Title:
Exception in getting TextBox
Name:
webcolin
Date:
2007-05-05 1:44:36 AM
Comment:
Hi Mohyuddin
I read your article, that is great, and very benifit for .NEt developer. thanks
I have my case working about 2days, I can't get it fix.. pls advice
when I try to get multi-line of Description string strDescription = string.Empty; strDesp = ((TextBox)(row.FindControl(dt.Columns[5].ColumnName))).Text;
I always get error: Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
thanks
|
Title:
ITemplate used instead of IBindableTemplate
Name:
G. Mohyuddin
Date:
2007-04-17 1:17:51 AM
Comment:
Wray Smallwood! Although I could not incorporate an IBindableTemplate example in this article as the the title is not primarily meant for that yet I have changed the current solution for ITemplate. ITemplate can provide the required features under the current title. I am thankful to you for suggesting it, I have removed all references of IBindableTemplate and have used ITemplate.
|
Title:
Re: sorting the dynamic gridview
Name:
GArao
Date:
2007-04-07 2:53:22 PM
Comment:
Looks like gridview just won't support sorting a templated column. I changed the CreateTemplatedGridView code to use a BoundField for one of the columns instead of a TemplateField and sort became active for the column.
|
Title:
Re: sorting the dynamic gridview
Name:
GArao
Date:
2007-04-06 3:55:42 PM
Comment:
I created a readonly version of your sample code and here is where I'm adding the sortexpression property. Maybe this is not the right place because the column headings are created as literals instead of linkbuttons. I added the onSorting event handler and allowsorting=true to the gridview declaration.
void CreateTemplatedGridView() { // fill the table which is to bound to the GridView PopulateDataTable(); // add templated fields to the GridView for (int i = 0; i < Table.Columns.Count; i++) { TemplateField ItemTmpField = new TemplateField(); // create HeaderTemplate ItemTmpField.HeaderTemplate = new GridViewHandler(ListItemType.Header, Table.Columns[i].ColumnName, Table.Columns[i].DataType.Name); // create ItemTemplate ItemTmpField.ItemTemplate = new GridViewHandler(ListItemType.Item, Table.Columns[i].ColumnName, Table.Columns[i].DataType.Name); ItemTmpField.SortExpression = Table.Columns[i].ColumnName; // then add to the GridView TableGridView.Columns.Add(ItemTmpField); }
// bind and display the data TableGridView.DataSource = Table; TableGridView.DataBind(); }
Should the sortexpression be created in the gridview handler instead?
|
Title:
Re: sorting the dynamic gridview
Name:
G. Mohyuddin
Date:
2007-04-06 2:47:05 AM
Comment:
Yes it should support but you need to set SortExpression property of particular field in code and write event handler of OnSorting event of the GridView. this may help you http://forums.asp.net/thread/1177923.aspx
|
Title:
sorting the dynamic gridview
Name:
GArao
Date:
2007-04-05 6:50:05 PM
Comment:
I tried add sortexpression/allowsorting at the gridview and the item template levels but I can't get the gridview to support sorting. Can it be done?
|
Title:
Re: give me replay of my question
Name:
G. Mohyuddin
Date:
2007-04-03 8:06:30 AM
Comment:
Would you please send me the error description
|
Title:
give me replay of my question
Name:
hitesh panchal
Date:
2007-04-03 7:30:56 AM
Comment:
please replay me on my mail id .
there are in your topic u write this line... '' string field = ((TextBox)row.FindControl(Table.Columns[i].ColumnName)).Text;''
u convert in vb form and in vb.net i write this in this form ''Dim fields As String = ((TextBox)(row.FindControl(Table.Columns(i).ColumnName)).Text)'' but i have occured error so u help me in form of send me solution on my mail id .
please ........................
|
Title:
Re: update problem
Name:
G. Mohyuddin
Date:
2007-03-05 1:39:04 AM
Comment:
Actually it has been left upto user to decide which column of the table, he decides to be the primary key field. My code assumes it is in first column. I have not disabled it for it will not allow editing in case if the first column is not primary key field. so it's left upto user for deciding the primary key feild and disabling it. Yet you may add samll piece of code to check primark key column dynamically and disable it.
|
Title:
Update Problem
Name:
Francis
Date:
2007-03-01 9:45:19 AM
Comment:
Hi,
It seems that when i try to edit the first column, the update will fail.
|
Title:
Very Nice
Name:
Vikram
Date:
2007-03-01 7:21:15 AM
Comment:
Hi,
Thanks a lot for this article it was a good help to understand how to work with datagrids dynamically through code!
|
Title:
Re GridView
Name:
Graham - South Africa
Date:
2007-02-19 1:44:41 PM
Comment:
Magnificent contribution - solved a lot for me well done
|
Title:
girdview
Name:
kishore
Date:
2007-02-15 5:29:23 AM
Comment:
how to create dynamic gridview
|
Title:
using ObjectDataSource
Name:
G. Mohyuddin
Date:
2007-02-14 12:43:25 AM
Comment:
Adam,i have not tested it for object data source but i think works fine with object data source as well, you need just to ensure that the InsertFlag has been set properly for using the edit mode for insertion.
|
Title:
Mr
Name:
Adam W
Date:
2007-02-12 8:24:57 AM
Comment:
I found your article from searching for a way of allowing the user to insert into a GridView. I have adapted your code to work with a TableAdapter and ObjectDataSource. The only problem is when clicking Insert it just performs an edit instead. Is there an easier way of inserting new records from within GridView?
Thanks for your time.
|
Title:
Dynamically Templated GridView with Edit, Delete and Insert Options
Name:
Wojtek Szewczyk
Date:
2007-02-11 11:14:37 AM
Comment:
Great example. You saved me a lot of work. I appreciate this.
Wojtek
|
Title:
about VB code
Name:
G. Mohyuddin
Date:
2007-02-07 6:46:08 AM
Comment:
Ok. I am planning to convert the code in near future. Till then you can use any converter like autility at http://www.developerfusion.co.uk/utilities/convertcsharptovb.aspx
|
Title:
ok
Name:
megha
Date:
2007-02-07 6:09:46 AM
Comment:
i want the code in vb.net i m trainee developer i don't know c#,asp but i am familier with vb.net
|
Title:
Thanks
Name:
G. Mohyuddin
Date:
2007-02-01 8:44:13 AM
Comment:
Thanks. Fayyaz Bhai. I am very greatful to you for your prayers and best wishes.
|
Title:
Your Work in general
Name:
Fayyaz Khan Lodhi
Date:
2007-02-01 5:16:56 AM
Comment:
AOA GM!
I have gone through the article in a skim. Havent seen the details yet but i just wanted you to know that i am pleased to see your work buddy. May Allah always keep you progressing. Ameen. It's a plausible effort.
|
Title:
Mr
Name:
VP5
Date:
2007-01-31 5:39:06 PM
Comment:
Great programming technique!
|
Title:
Grid View
Name:
Zar and Shafqat
Date:
2007-01-31 7:40:05 AM
Comment:
Congratulation! This is a big effort of you that you can do this. May Allah give you more much talent in this field. SALAM
|
Title:
Thanks
Name:
G. Mohyuddin
Date:
2007-01-26 1:30:28 AM
Comment:
Thanks, Ricky and Amir. I will try to convert the code into ASP.NET/VB.NET 2.0 inshAllah.
|
Title:
(Y)
Name:
M Aamir Mughal
Date:
2007-01-25 11:40:55 PM
Comment:
it is really good work GM ... (Y)
keep it up ... my prays are there :)
|
Title:
Re-About Gridview
Name:
Ricky
Date:
2007-01-25 7:59:49 AM
Comment:
You work is quite appreciatable, kindly do this same in ASP/VB.NET 2.0 for learning purpose. Hope u can Convert this in VB.NET as well TC Ricky
|