Click here to Skip to main content
15,899,935 members
Home / Discussions / C#
   

C#

 
AnswerRe: How to write java script for image upload on choose file type not in click function Pin
CHill6010-Jun-15 4:56
mveCHill6010-Jun-15 4:56 
Question(SOLVED) C# .NET File.Delete() Not Working. Pin
uniflare9-Jun-15 16:28
uniflare9-Jun-15 16:28 
Questionhow to fill textbox with data from access database in c sharp windows application Pin
Being The Sharan Kumar9-Jun-15 7:31
Being The Sharan Kumar9-Jun-15 7:31 
AnswerRe: how to fill textbox with data from access database in c sharp windows application Pin
Richard Deeming9-Jun-15 7:58
mveRichard Deeming9-Jun-15 7:58 
QuestionSystem.Linq.Dynamic.DynamicExpression.ParseLambda issue with Select() command Pin
HUONG Minh-Luong9-Jun-15 4:31
HUONG Minh-Luong9-Jun-15 4:31 
QuestionRe: System.Linq.Dynamic.DynamicExpression.ParseLambda issue with Select() command Pin
Richard Deeming9-Jun-15 5:57
mveRichard Deeming9-Jun-15 5:57 
AnswerRe: System.Linq.Dynamic.DynamicExpression.ParseLambda issue with Select() command Pin
HUONG Minh-Luong9-Jun-15 7:14
HUONG Minh-Luong9-Jun-15 7:14 
QuestionHow to populate a DropDownList in a DataGrid? Pin
Member 85894998-Jun-15 3:51
Member 85894998-Jun-15 3:51 
I have a DataGrid that displays information about trailers. I decided to change the location column to a DropDownList so the location can be easily changed. But I am not sure how to populate the DropDownList.

ASP.NET
<asp:DataGrid runat="server" CssClass="tblResults" OnItemDataBound="dgList_ItemCreated" OnRowDataBound="OnRowDataBound" AllowSorting="true" OnSortCommand="dgTrailer_Sort" ID="dgTrailers" DataKeyField="ID" AutoGenerateColumns="false">
            <Columns>
                <asp:BoundColumn DataField="TrailerOwner" HeaderText="Owner" SortExpression="TrailerOwner"></asp:BoundColumn>
                <asp:BoundColumn DataField="TrailerMake" HeaderText="Trailer Make" SortExpression="TrailerMake"></asp:BoundColumn>
                <asp:TemplateColumn HeaderText="Trailer Location">
                    <itemtemplate>
                        <asp:DropDownList ID="ddlLocation" runat="server">
                        </asp:DropDownList>
                 </itemtemplate>
                </asp:TemplateColumn>
                </Columns>
        </asp:DataGrid>

I have a DropDownList for location already (called ddlTrailerLocation) so the user can select the location for the trailer and then the DataGrid displays all that information. Here's how I populated ddlTrailerLocation:

C#
protected void PopulateDDLs()
{
    DataSet dsTrailerLocation = DataUtils.GetAllGenSmall(Company.Current.CompanyID, "Description", "", 1, false, "Description", false, "TrailerLocationNOCODE", 0);
    if (dsTrailerLocation.Tables[0].Rows.Count > 0)
    {
        ddlTrailerLocation.DataSource = dsTrailerLocation;
        ddlTrailerLocation.DataValueField = "Description";
        ddlTrailerLocation.DataTextField = "Description";
        ddlTrailerLocation.DataBind();
        ddlTrailerLocation.Items.Insert(0, new ListItem("Select One", "0"));
    }
    else
    {
        ddlTrailerLocation.Items.Insert(0, new ListItem("No Locations Entered", "0"));
    }
}

Is there something I can add to this method to display the correct location of each trailer in the DataGrid? The location column was displaying the location but is now just showing an empty DropDownList
AnswerRe: How to populate a DropDownList in a DataGrid? Pin
User 418025410-Jul-15 11:55
User 418025410-Jul-15 11:55 
Questionneed help to use telegram api in c# Pin
adalat1237-Jun-15 19:30
adalat1237-Jun-15 19:30 
AnswerRe: need help to use telegram api in c# Pin
Richard MacCutchan7-Jun-15 21:20
mveRichard MacCutchan7-Jun-15 21:20 
QuestionWhat do these c# lines mean???? Pin
Django_Untaken7-Jun-15 5:33
Django_Untaken7-Jun-15 5:33 
AnswerRe: What do these c# lines mean???? Pin
Dave Kreskowiak7-Jun-15 5:42
mveDave Kreskowiak7-Jun-15 5:42 
GeneralRe: What do these c# lines mean???? Pin
OriginalGriff7-Jun-15 6:04
mveOriginalGriff7-Jun-15 6:04 
GeneralRe: What do these c# lines mean???? Pin
Dave Kreskowiak7-Jun-15 6:35
mveDave Kreskowiak7-Jun-15 6:35 
GeneralRe: What do these c# lines mean???? Pin
OriginalGriff7-Jun-15 6:43
mveOriginalGriff7-Jun-15 6:43 
AnswerRe: What do these c# lines mean???? Pin
OriginalGriff7-Jun-15 6:04
mveOriginalGriff7-Jun-15 6:04 
AnswerRe: What do these c# lines mean???? Pin
Ravi Bhavnani9-Jun-15 6:34
professionalRavi Bhavnani9-Jun-15 6:34 
AnswerRe: What do these c# lines mean???? Pin
Gergilcan13-Jun-15 22:01
professionalGergilcan13-Jun-15 22:01 
QuestionError: Operator '>' cannot be applied to operands of type 'double' and 'System.Random' Pin
Member 117477347-Jun-15 2:37
Member 117477347-Jun-15 2:37 
AnswerRe: Error: Operator '>' cannot be applied to operands of type 'double' and 'System.Random' Pin
Sascha Lefèvre7-Jun-15 2:59
professionalSascha Lefèvre7-Jun-15 2:59 
GeneralRe: Error: Operator '>' cannot be applied to operands of type 'double' and 'System.Random' Pin
Member 117477347-Jun-15 3:00
Member 117477347-Jun-15 3:00 
AnswerRe: Error: Operator '>' cannot be applied to operands of type 'double' and 'System.Random' Pin
Dave Kreskowiak7-Jun-15 3:15
mveDave Kreskowiak7-Jun-15 3:15 
AnswerRe: Error: Operator '>' cannot be applied to operands of type 'double' and 'System.Random' Pin
Afzaal Ahmad Zeeshan7-Jun-15 4:24
professionalAfzaal Ahmad Zeeshan7-Jun-15 4:24 
QuestionHow public static declaration for Statusbar Control ? Pin
Member 24584676-Jun-15 23:41
Member 24584676-Jun-15 23:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.