Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
T

Terick

@Terick
About
Posts
37
Topics
18
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Post to Database and Return Identity
    T Terick

    Hi, I'm using ASP.NET with C# and SQL. I have a BLL and DAL set up for interaction with SQL. I have a user input webform with a link button. I need the link button to post the input to the database and pass the new identity value on to the page it navigates to. Can someone please help me on the code for this? This is what I have so far:

    protected void LinkButton1_Click(object sender, EventArgs e)
    {
    ObjectDastaSource1.InsertParameters["Name"].DefaultValue=(FindControl("txtName") as Textbox).Text;
    ObjectDataSource1.InsertParameters["User"].DefaultValue=(FindControl("ddlUser")as DropDownList).SelectedItem.Text;
    ObjectDataSource1.InsertParameters["Email"].DefaultValue=(FindControl("txtEmail")as Textbox).Text;
    ObjectDataSource1.InsertParameters["Start"].DefaultValue=(FindControl("cStart") as Calendar).SelectedDate.ToShortDateString();
    ObjectDataSource1.Insertparameters["End"].DefaultValue=(FindControl("cEnd") as Calendar).SelectedDate.ToShortDateString();
    ObjectDataSource.DataBind();

    ASP.NET csharp database asp-net help question

  • Calculations
    T Terick

    Hi, I need to create a table in SQL that will compute costs. I have to read in some information from two other tables and use this to populate the new table from which the costs are calculated. As the data is from a website, it is possible that it will change and I need the costs to update if the data changes. Do I need to create a function to do this, or will the table do it on its own? ( I elected to do a function, but if there is a better way I am open to that) This is what I have so far:

    set ANSI_NULLS ON
    go
    set QUOTED_IDENTIFIER ON
    go

    CREATE FUNCTION [dbo].[fcn_computecosts]
    ( @ProjectID int, @userID int, @startDate datetime, @enddate datetime, @quarter tinyint,
    @Cost money, @percent int, @totalDays int, @totalcost)

    RETURNS @ComputeCosts TABLE
    ( ProjectID int, userID int, startDate datetime, enddate datetime, quarter tinyint,
    Cost money, percent int, totalDays int, totalcost)

    AS
    BEGIN
    SELECT
    P.ProjectID, P.userID, P.startDate, P.enddate, C.quarter,P.Cost, P.percent,
    COUNT(C.date) AS totalDays, ((percent/100)*totaldays*Cost*8) AS totalcost

    FROM Project AS P INNER JOIN Calendar AS C ON Calendar.date >P.startDate AND Calendar.date <=
    P.enddate
    WHERE (C.isWeekday =1) AND (C.isHoliday=0)
    GROUP BY P.ProjectID, P.userID, P.startDate, P.enddate, C.quarter,P.Cost, P.percent,
    totalDays, totalcost
    ORDER BY P.ProjectID
    RETURN
    END

    However when I run this I am getting the following error: "msg 207, Level 16, state 1: Invalid column name 'totalDays', 'totalcost', 'Cost' Please help!

    Database help database question announcement

  • Repeater Control?
    T Terick

    I ended up using a datalist instead of a repeater and was able to solve this issue. Thanks for your help!

    ASP.NET database question tutorial

  • Repeater Control?
    T Terick

    What is the best way by which to display summary information for my project on my webform? I need to display it as follows and cannot use a datagrid.

     Column         Column
    

    Row: Name Name
    Row: ID ID
    Row: Size Size

    With a column for each returned value from the database. There is no restriction to the number of "segments" returned, so I need to this to work if there is one segment or 5. I have a SQL query that accesses the information that I read from. I thought about using a repeater control, but I'm not sure how to do this.

    ASP.NET database question tutorial

  • Find Control on webform
    T Terick

    Yes! That was my problem. I was not referencing the Master Page and ContentPlaceHolder. Thank you for pointing that out to me.

    C#

  • Find Control on webform
    T Terick

    When I drill down into the error, into the Page property, the Page directs itself correctly and the button is listed under the [ASP.Page_aspx] base but there is no FindControl option listed. Any ideas as to why this is?

    C#

  • Find Control on webform
    T Terick

    Yes have tried that: Button button=(Button)Page.FindControl("btn"); The Page will return the correct page, but nothing gets assigned to button, so I am getting nullReferenceException error.

    C#

  • Find Control on webform
    T Terick

    Hi, I have a button on my webform that I need to access from my user control code behind, not the page on which the button resides, but I'm not sure how I find it. I've thought it would be something like this, but this doesnt work: Button button=(Button)FindControl("btn"); Thanks!

    C#

  • Javascript to enable/disable textbox based on checkbox [modified]
    T Terick

    Thank you all for helping me. Also, ToddHileHoffer, thanks for posting the link.

    ASP.NET question csharp javascript asp-net business

  • [Message Deleted]
    T Terick

    [Message Deleted]

    ASP.NET

  • Javascript to enable/disable textbox based on checkbox [modified]
    T Terick

    Would the ajax solution be better to use? I am not familiar with ajax so I am not sure how to do this. Thanks.

    ASP.NET question csharp javascript asp-net business

  • Javascript to enable/disable textbox based on checkbox [modified]
    T Terick

    Hi~ I have a user control with a gridvew that contains a checkbox and textbox. The textbox is set to Enabled=false by default. On Page 1: the Header of the checkbox column is "Remove" and there is a Save button. On this page I need all UNCHECKED rows to have an enabled textbox On Page 2: the Header of the checkbox column is "Select". On this page I need all CHECKED rows to have an enabled textbox and all others to be disabled. How do I create the javascript for these requirements? I am using asp.Net and C#. Here is my sample code: UserControl.ascx:

    Current JavaScript:

    function CheckChanged(cb, tb)
    {
    var chkBox=document.getElementById(cb);
    var txtSize=document.getElemetnById(tb);
    if(chkBox.checked)
    {
    txtSize.disabled=true;
    txtSize.style.backgroundColor=\"lightgray\";
    }
    else
    {
    txtSize.disabled= false;
    }
    }

    This javascript is getting written via a StringBuilder in the .aspx.cs file of each page. Currently, I can only get the script to work properly for Page 2. On Page 1, I need the textbox to always be enabled unless something is checked. What is the best way to enable the textboxes on this page? Thanks!

    modified on Wednesday, February 25, 2009 9:39 AM

    ASP.NET question csharp javascript asp-net business

  • Enable Textbox on Gridview
    T Terick

    Hi, I have a gridview with a textbox template field. On two pages I need this textbox to be enabled but on a third page it must be disabled. What is the best way to do this? My gridview is a user control. Right now I'm doing this:

    If I change enabled to true then on all the pages the textbox is editable. Is there a way I can call the textbox property in the user control to enable or disable the textbox? For example (this isnt working though):

    public bool EnableTextBox
    {
    get
    {
    return txtSize.Enabled;
    }
    set
    {
    txtSize.Enabled=Value;
    }
    }

    Please help! Thanks =)

    ASP.NET question help tutorial

  • Show only 'A' items in gridview
    T Terick

    Perhaps I wasn't clear enough. Page 1- Select from All available items, but default screen shows only items starting with letter A. The user can select or search for other items by clicking on a letter of the alphabet. Page 2 - shows All of the selected items from page 1. I need help with Page 1 and only showing the items that start with letter A.

    ASP.NET question

  • Show only 'A' items in gridview
    T Terick

    How do I do that? I am using a user control so that one the first screen all of the items are available, but only those starting with the letter A are shown unless the user sorts the gridview. On all subsequent pages, however, only the selected items are shown, and all of those must appear.

    ASP.NET question

  • Show only 'A' items in gridview
    T Terick

    Hi, I have a gridview that is sorted alphabetically and has a header that allows the user to sort through the items by clicking on a letter. How do I set the gridview so that on the page load, only the items that start with 'A' are shown? Thanks!

    ASP.NET question

  • Dictionary&lt;string,&gt; to Dictionary&lt;int,&gt;
    T Terick

    I made the changes you suggested and am now getting the following error: A first chance exception of type 'System.Threading.ThreadAbortException' occurred in mscorlib.dll An exception of type 'System.Threading.ThreadAbortException occurred in mscorlib.dll but was not handled in user code A first chance exception of type 'System.FormatException' occurred in mscorlib.dll How do i fix this?

    ASP.NET help question tutorial

  • Dictionary&lt;string,&gt; to Dictionary&lt;int,&gt;
    T Terick

    Hi, I have a Dictionary<string,> object that uses the Item name as the Key (string) and Size as the Item (decimal). However, on some occasions, the Item name repeats itself, but the itemIDs are always unique. So, I want to switch my Dictionary<string,> to be Dictionary<int,decimal>. My problem occurs when I am trying to get items that are checked from the datagrid. Right now this is the code:

    public void GetChecked()
    {
    Dictionary<string,decimal> Checked=(Dictionary<string,decimal> )Session["CheckedItems"];
    string itemname;
    CheckBox cb;
    TextBox tb;

    if (Checked !=null)
    {
    foreach (GridViewRow gvRow in gvwItems.Rows)
    {
    itemname= gvRow.DataKeys[row.RowIndex].Value.ToString();

    if(Checked.ContainsKey(itemname))
    .
    .
    .
    .

    How do I alter this code to read the item_id which is an integer and not a string? Please help if you can, I am very stuck on this and do not know how to proceed. Thank you.

    ASP.NET help question tutorial

  • DataGrid to DataBase
    T Terick

    Thank you for your reply, however, I am not sure how to read in the data from the columns (columns: Remove, ItemName, ItemID, Size, Date, Amount) into my stored procedure that takes the following inputs (Project Id, ItemID, Size, User) where ProjectID and User are from the session but ItemID and Size are from the DataGrid.

    ASP.NET database css help tutorial question

  • DataGrid to DataBase
    T Terick

    Hi, I have a DataGrid with the following columns: Remove, ItemName, ItemID, Size, Date, Amount. When the user clicks "Save" I need to cycle through the grid and if any of the Remove Checkboxes are checked, that row needs to get removed, but if the row isnt checked it gets saved to the database using a stored procedure with inputs (Project_ID, ItemID, Size, User). I know how to go through the DataGrid to check to see if the checkbox is checked and then to remove it, but I'm not sure how to take the non-checked rows and add them to the database. Can someone please help me with this code?

    protected void btnSave_onClick(object sender, EventArgs e)
    {
    foreach (GridViewRow row in Control.GridViewRows)
    {
    CheckBox cboxremove = (CheckBox)row.FindControl("cbxRemove");
    if (cboxremove.Checked)
    {
    RemoveCheckedTitles();
    }
    else
    {
    ???????????????
    }
    }

    Please Help! Thanks

    ASP.NET database css help tutorial question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups