Congratulations to all the winners of April 2013, they have won INR 3400 cash and INR 20147 worth prizes !
DotNetFunda.Com Logo
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 3027 |  Welcome, Guest!   Register  Login
 Home > Forums > C# > Problem with combobox in datagridview ...
Mahesh_Chs

Problem with combobox in datagridview

Replies: 4 | Posted by: Mahesh_Chs on 9/15/2012 | Category: C# Forums | Views: 840 | Status: [Member] | Points: 10  


hi,

i have a combobox in datagridview control, the prooblem is how can i get the selected value from combobox...
the combobox contains id values of my table


Reply | Reply with attachment | Alert Moderator

 Responses below this adGet hundreds of .NET Tips and Tricks videos

 Replies

T.Saravanan
T.Saravanan  
Posted on: 9/15/2012 2:52:47 PM
Level: Silver | Status: [Member] [MVP] | Points: 25

Mahesh_Chs, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Hariinakoti
Hariinakoti  
Posted on: 9/17/2012 2:19:05 AM
Level: Starter | Status: [Member] | Points: 25

Hi,
see this link
http://www.codeproject.com/Articles/31347/Creating-an-ASP-NET-GridView-Custom-Field-of-type

Thanks & Regards
Hari

Mahesh_Chs, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Vikash
Vikash  
Posted on: 9/17/2012 7:15:17 AM
Level: Starter | Status: [Member] | Points: 25

PLease Use this...
define an event in drop down list like following
<asp:DropDownList ID="DropDownList1" runat="server"
onselectedindexchanged="DropDownList1_SelectedIndexChanged">
</asp:DropDownList>

and then access the value
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
DropDownList ddl = (DropDownList)sender;
string str = ddl.SelectedValue;
}

if it is helpful mark as answer....

Regards,
Vikash Pathak

Mahesh_Chs, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Rimi1289
Rimi1289  
Posted on: 2/1/2013 5:40:03 AM
Level: Starter | Status: [Member] | Points: 25

Protected Overrides Function ProcessCmdKey(ByRef msg As System.Windows.Forms.Message, ByVal keyData As System.Windows.Forms.Keys) As Boolean

If keyData = Keys.Enter Then
If ActiveControl.Name = "ComboBox1" Then
ComboBox1.Visible = False

With DataGridView1
.Focus()
.Item(.CurrentCell.ColumnIndex, .CurrentRow.Index).Value = Trim(ComboBox1.Text)
.CurrentCell = .Rows(.CurrentRow.Index).Cells(.CurrentCell.ColumnIndex + 1)
End With
end if

end if


You can check the entire code here... http://www.encodedna.com/2013/02/show-combobox-datagridview.htm

Mahesh_Chs, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Reply - Please login to reply


Click here to login & reply

About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 5/18/2013 11:37:44 AM