473,386 Members | 1,790 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Drop Down in Datagrid Edit Template

hello
I am using drop down in edit template instead of textbox. it runs properly bt problem is that when i click on the edit button then the selected value doesnt shown there, instead of 0th index value is shown in drop down.
I want that the value which was shown on datagrid before edit is also shown after clicking on the edit button.

Thanks in advance for your valuable suggestions
Feb 25 '08 #1
5 3180
In your grid views' _RowEditing function load your drop downs as you would noramly and then use FindByText method giving text box values as parameters search that list item and set its Selected property to TRUE.

e.g.

dropDownReviewType.Items.FindByText(((TextBox)grid Review.Rows[e.NewEditIndex].FindControl("ReviewTypeTextBox")).Text).Selected = true;
Feb 25 '08 #2
In your grid views' _RowEditing function load your drop downs as you would noramly and then use FindByText method giving text box values as parameters search that list item and set its Selected property to TRUE.

e.g.

dropDownReviewType.Items.FindByText(((TextBox)grid Review.Rows[e.NewEditIndex].FindControl("ReviewTypeTextBox")).Text).Selected = true;

Hello
Thanks. But in this code i am not understanding that what's the dropdown field name and when i type this one i got an error. and even i dnt find the FindByText method. Is it user defined?
Please give me your suggestion in detail.
Thanks once again
Feb 26 '08 #3
In Follwoing:
dropDownReviewType.Items.FindByText(((TextBox)grid Review.Rows[e.NewEditIndex].FindControl("ReviewTypeTextBox")).Text).Selected = true;

DropDown name is dropDownReviewType and the function is in the Items collection.
Here actually i am trying to find that List item whose text is same as the ReviewTypeTextBox's Text property and setting its value to selcted.

Hope it clarifies...
paste the error if you still encounter one.
Feb 26 '08 #4
In Follwoing:
dropDownReviewType.Items.FindByText(((TextBox)grid Review.Rows[e.NewEditIndex].FindControl("ReviewTypeTextBox")).Text).Selected = true;

DropDown name is dropDownReviewType and the function is in the Items collection.
Here actually i am trying to find that List item whose text is same as the ReviewTypeTextBox's Text property and setting its value to selcted.

Hope it clarifies...
paste the error if you still encounter one.

And what's FindByText here.if i type this one i got an error
Feb 26 '08 #5
And what's FindByText here.if i type this one i got an error
Have a look at MSDN ListControl.Items, its a function of it.
Feb 27 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: owyn | last post by:
Think of a Drop Down List in a template column in a data grid in the Edit Template. In the Item template there is a label whose: text = '<%# DataBinder.Eval(Container.DataItem, "FieldName")%>' The...
1
by: Marlene harkcom | last post by:
I've got a datagrid with 5 bound columns in it as well as an edit/update/cancel column. I'm binding this to a dataset. One of the fields is always going to be one of three values. I want the...
3
by: Jim Heavey | last post by:
Trying to figure out the technique which should be used to add rows to a datagrid. I am thinking that I would want an "Add" button on the footer, but I am not quite sure how to do that. Is that...
4
by: Stephan Bour | last post by:
Hi, I have a datagrid databound to a SQL query. I'd like to allow editing of some columns but not all. Is there a way to turn off the conversion of the datagrid cells to textboxes for some columns...
2
by: Benign Vanilla | last post by:
I am a .NET newbie, and need some help. I have a datagrid that is bound to a table. That works. I also have a template column in the grid for updating a status value for each row. This is...
4
by: Chris Kettenbach | last post by:
Good Morning, Quick question, I have an EditItemTemplate inside a datagrid. It should contain a drop down list of possible choices. I have an EditCommandColumn. The drop dow list column should...
0
by: kaon | last post by:
Hi, Ive been looking for a way to capture an autopostback event of a dropdownlist in a datagrid control. the scenario is that, ive a datagrid, and there is a dropdownlist column in each of the row...
0
by: weiwei | last post by:
Hi here is my scenario, I create a drop down list in itemtemplate.(that drop down is created from db), after user click edit command, my ideal plan is have another drop down list in...
8
by: =?Utf-8?B?bWlrZWc=?= | last post by:
Hi, I am building a small Help Desk application for my company and need to be able to edit "open" help desk issues. I use a simple datagrid to display each issue (6 per page) , with an Edit...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.