bind the content to a data table and add the new column to it (from db
or your dropdownlist) and again bind back to original dataset/
datagrid.
It will display the updated records.



On Feb 10, 10:58 am, santhosh vs <[email protected]> wrote:
> To my knowledge a column cannot be simply added to existing, need copy to a
> new dataset, and many proved fast methods exist for this , Google for the
> copy methods and select one.
>
>
>
> On Sat, Feb 7, 2009 at 5:01 PM, Anju <[email protected]> wrote:
>
> > hi,
> > how to add new column to existing dataset table and fill that dataset
> > with dropdownlist selected values. any one pls help me.  when user
> > check the checkbox,droplist enabled for selecting the values.
> > dropdownlist values manually i added in datagrid.
>
> > <asp:TemplateColumn HeaderText="Duration">
>
> >                            <ItemTemplate>
>
> >                                    <asp:DropDownList ID="ddlduration"
> > Runat="server"
> > AutoPostBack="False" Enabled="False">
> >                                                     <asp:ListItem
> > Value="30" Selected="True"></asp:ListItem>
>
> >                                            <asp:ListItem
> > Value="60"></asp:ListItem>
>
> >                                            <asp:ListItem
> > Value="90"></asp:ListItem>
>
> >                                    </asp:DropDownList>
>
> >                            </ItemTemplate>
>
> >                    </asp:TemplateColumn>
>
> > private void btnSubmit_Click(object sender, System.EventArgs e)
> >                {
> >                        DataSet dscourse=(DataSet)ViewState["ds"];
> >                        DataSet selected =
> > ((DataSet)ViewState["ds"]).Clone() ;
>
> >                        string total = lblTotalPrice.Text;
> >                        foreach (DataGridItem dgItem in
> > dgExtendCourse.Items)
> >                        {
> >                                HtmlInputCheckBox chkclick =
> > (HtmlInputCheckBox)dgItem.FindControl
> > ("chkselect");
> >                                Label lblcource =
> > (Label)dgItem.FindControl("lblCourseName");
> >                                Label
> > lblDays_Left=(Label)dgItem.FindControl("lblDaysLeft");
> >                                DropDownList ddlDuration =
> > (DropDownList)dgItem.FindControl
> > ("ddlduration");
>
> >                                if (chkclick.Checked==true)
> >                                {
>
> >                                 foreach (DataRow row in
> > dscourse.Tables[0].Rows)
> >                                        {
> >                                                if
> > (row["coursename"].ToString() == lblcource.Text && row
> > ["DaysLeft"].ToString()==lblDays_Left.Text)
> >                                                {
>
> >  selected.Tables[0].ImportRow(row);
> >                                                }
> >                                        }
> >                                }
> >                        }
> >                        if (selected.Tables != null &&
> > selected.Tables[0].Rows.Count > 0)
> >                        {
> >                                Session["selectedrow"] = selected;
> >                                Session["totalprice"] =
> > HidenTotal.Value.ToString();
>
> >                            Response.Redirect("StudentRegistration.aspx");
> >                        }
>
> >                }
>
> --
> My Web Sitehttp://everlovingyouth.googlepages.com
> My Technical Bloghttp://acutedeveloper.blogspot.com
> Skype :santhoshnta
> Orkut :everlovingyouth

Reply via email to