473,785 Members | 2,789 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

dropdownlist index in an editable datagrid

I have an editable datagrid
one of itz column is a dropdownlist
<asp:TemplateCo lumn>
<ItemTemplate > <asp:Label ID=lblAreaWebsi teID Runat=server
text='<%#
DataBinder.Eval (Container.Data Item,"WebsiteNa me")%>'></asp:Label>
</asp:Label>
</ItemTemplate>
<EditItemTempla te>
<asp:DropDownLi st ID="ddlWebsiteN ame_edit" Runat=server
DataSource="<%# PopulateWebsite ID()%>" DataTextField=" name"
DataValueField= "id"
OnPreRender=Set DropDownIndexFo rWebite></asp:DropDownLis t>
</asp:TextBox>
</EditItemTemplat e>
</asp:TemplateCol umn>

I want to set the dropdownindex on the ddl to the seleced index in edit
mode.

what i do rite now is
public void SetDropDownInde xForWebite(obje ct sender,System.E ventArgs e)
{
DropDownList ed;
ed = (DropDownList)s ender;
ed.SelectedInde x = ed.Items.IndexO f(ed.Items.Find ByText(name));
}

protected void dgAreaList_Edit (object sender,DataGrid CommandEventArg s
e)
{
dgAreaList.Show Footer= false;
dgAreaList.Edit ItemIndex= e.Item.ItemInde x;
Label lblAreaWebsiteI D =
(Label)e.Item.F indControl("lbl AreaWebsiteID") ;
getAreaList();
name = lblAreaWebsiteI D.Text;
}

but it doesnt work.

Jan 3 '06 #1
0 1402

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1615
by: Stephan Bour | last post by:
Hi, I¹ve tried to implement a solution to populate a dropdownlist inside an editable datagrid. The code is simple enough and an example can be found here: <http://www.4guysfromrolla.com/webtech/050801-1.shtml> The problem I'm having is that the entire datagrid disappears after I click the Edit link. Could someone tell me what I'm doing wrong? Much appreciated, Stephan.
0
272
by: anon | last post by:
Hi All, I have an editable datagrid in which one of the fields becomes a Drop dowl list in edit mode....i followed the example in the $ guysfrom rolla article http://www.4guysfromrolla.com/webtech/050801-1.2.shtml however one of them is not really populated from the database, and hence no need of a dataview...i would like to assign an array or arraylist alone to it, however it gives all sorts of errors....the code is as follows
2
2347
by: Kay Chan | last post by:
Hi All, I am going to using a editable datagrid, one of the field should be a dropdownlist, here is my code <EditItemTemplate> <asp:DropDownList ID="INVESTMENT_FUND_ID" DataSource="<%# getINVESTMENT_FUND() %>" DataTextField="NAME" DataValueField="VALUE"
0
1833
by: Daniel Doyle | last post by:
Hello and apologies in advance for the amount of code in this post. I've also sent this message to the Sharepoint group, but thought that ASP.NET developers may also be able to help, even though it's a Sharepoint WebPart. I'm trying to do something fairly simple, create a datagrid that displays where and when a person works and allows them to change some of the information via DropDownLists. When the user clicks to edit a row, three of...
4
2011
by: Mark Waser | last post by:
I've discovered a very odd bug when attempting to put a dropdown list in a datagrid. In the page PreRender step, the selected index of the datagrid is successfully set during databinding. Yet, when the datagrid enters it's own OnPreRender, the selected index has reverted to zero. I created a debug version of the dropdown list which inherited from dropdownlist and overrode the selected index property to trace.write whenever it was...
1
2369
by: jimb | last post by:
I can get the dropdownlist into the datagrid, and I can populate it, but I can't read it. Anybody have a working example of a dropdownlist in an editable grid? Thanks. -- .. http://sf-f.org, weblog and search engine for fans and writers of
3
1792
by: Jeff | last post by:
I have added a dropdownlist to an editable datagrid to allow a user to select Yes or No: <ItemTemplate> <asp:Label runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "reports") %>' ID="lblReports"/> </ItemTemplate> <EditItemTemplate> <asp:DropDownList runat="server" id="ddlReports"> <asp:ListItem value="Yes">Yes</asp:listItem>
0
1084
by: shamila | last post by:
I have an editable datagrid one of itz column is a dropdownlist <asp:TemplateColumn> <ItemTemplate> <asp:Label ID=lblAreaWebsiteID Runat=server text='<%# DataBinder.Eval(Container.DataItem,"WebsiteName")%>'></asp:Label> </asp:Label> </ItemTemplate> <EditItemTemplate> <asp:DropDownList ID="ddlWebsiteName_edit" Runat=server
2
1733
by: Frank | last post by:
Hello, I am developing with VS.Net 2003 on the asp 1.1 platform. I am a few days new to using a datagrid. I found a nice tutorial and had no problems using an editable datagrid with textboxes and an additional buttoncolumn where I used a delete button to delete a specific row. Once I had finished that, I trnsformed the grid tso it will display a dropdownlist indtead of a textbox. After much grappling, I pretty much have
0
10336
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10155
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8978
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7502
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6741
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5513
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4054
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3655
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2881
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.