Search

You searched for the word(s): userid:638499

Matching Posts

  • Re: how to do update in LINQ

    updateDataContext.tblCust.Where(c => c.Name.Equals( "John" ));
  • Re: how do i remove the time from the DateTime property

    [quote user="kipo"] You can try with this: view plain copy to clipboard print ? public DateTime Date { get { return Convert.ToDateTime(txtDate.Text).ToString( "d" ); } } public DateTime Date { get { return Convert.ToDateTime(txtDate.Text).ToString("d"); } } Instead of "d", you can use a lot of different patterns - here is a collection of them: http://www.geekzilla.co.uk/View00FF7904-B510-468C-A2C8-F859AA20581F.htm [/quote] In order to do this, you must change
    Posted to Web Forms (Forum) by ecbruck on 9/2/2009
  • Re: get drop down values in gridview

    Do something like this: protected void btnSave_Click(object sender, EventArgs e) { foreach (GridViewRow row in GridView1.Rows) { DropDownList ddl = row.FindControl("DropDownList1") as DropDownList; if (ddl != null) { string value = ddl.SelectedValue; // Save to db here } } }
    Posted to Data Presentation Controls (Forum) by ecbruck on 9/2/2009
  • Re: Using dr.ItemArray with Column Names?

    Sure, try this: foreach (DataRow dr in dt.Rows) { listedEmail = dr["Email"].ToString(); title = dr["Title"].ToString(); }
    Posted to Data Presentation Controls (Forum) by ecbruck on 9/2/2009
  • Re: get drop down values in gridview

    Try this: protected void btnSave_Click(object sender, EventArgs e) { List<string> values = new List<string>(); foreach (GridViewRow row in GridView1.Rows) { DropDownList ddl = row.FindControl("DropDownList1") as DropDownList; if (ddl != null) { values.Add(ddl.SelectedValue); } } string value = String.Join(",", values.ToArray()); }
    Posted to Data Presentation Controls (Forum) by ecbruck on 9/2/2009
  • Re: how do i remove the time from the DateTime property

    [quote user="young345"] i tried this but i get an error saying 'Cannot implicitly convert type 'string' to 'System.DateTime' do you knwo what that means? and how i can resolve it thank you [/quote] As I stated in my previous post, you can NOT return a String for a DateTime property. You MUST either change the type of your property to a String or modify the DateTime value AFTER the property is currently called.
    Posted to Web Forms (Forum) by ecbruck on 9/2/2009
  • Re: how do i remove the time from the DateTime property

    The Date property will only ever return a DateTime which will contain the full date/time. You must either use this property and convert to a formatted string or you could always add another readable property like this: public DateTime Date { get { return Convert.ToDateTime(txtDate.Text); } } public string ReadableDate { get { return this.Date.ToShortDateString(); } }
    Posted to Web Forms (Forum) by ecbruck on 9/2/2009
  • Re: Object reference not set to an instance of an object

    Is your row really selected? Is the Cells[2] reference valid? I'd personally fire up the debugger and set a breakpoint within your code. Then, I'd check to see what is coming back as null. At that point, you can then decide what to do.
    Posted to Getting Started (Forum) by ecbruck on 9/1/2009
  • Re: Convert VB to C#

    Thanks for the reminder. I always get those mixed up.
    Posted to C# (Forum) by ecbruck on 9/1/2009
  • Re: Grid and DropDownList question

    If you've placed the name of your ID field into the GridView.DataKeyNames property, then you can retrieve it something like this: Protected Sub gvEvalList_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Dim ddl As DropDownList = DirectCast(sender, DropDownList) Dim gvr As GridViewRow = TryCast(ddl.NamingContainer, GridViewRow) If Not gvr Is Nothing Then Dim id As String = GridView1.DataKeys(gvr.RowIndex)("ID").ToString End If End Sub
    Posted to Web Forms (Forum) by ecbruck on 9/1/2009
Page 1 of 914 (9138 items) 1 2 3 4 5 Next > ... Last »