Click here to Skip to main content
15,908,254 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: login page Pin
N a v a n e e t h24-Aug-09 20:49
N a v a n e e t h24-Aug-09 20:49 
GeneralRe: login page Pin
Ashfield24-Aug-09 21:09
Ashfield24-Aug-09 21:09 
Questiondynamic menu... Pin
RajpootRohan24-Aug-09 19:08
professionalRajpootRohan24-Aug-09 19:08 
AnswerRe: dynamic menu... Pin
Christian Graus24-Aug-09 19:12
protectorChristian Graus24-Aug-09 19:12 
GeneralRe: dynamic menu... Pin
RajpootRohan24-Aug-09 19:30
professionalRajpootRohan24-Aug-09 19:30 
GeneralRe: dynamic menu... Pin
Christian Graus24-Aug-09 19:32
protectorChristian Graus24-Aug-09 19:32 
GeneralRe: dynamic menu... Pin
RajpootRohan24-Aug-09 21:32
professionalRajpootRohan24-Aug-09 21:32 
QuestionCannot implicitly convert type 'string' to 'System.Web.UI.WebControls.TextBox' Pin
haleemasher24-Aug-09 18:21
haleemasher24-Aug-09 18:21 
When i run the code below it show error in bold line of code that "Cannot implicitly convert type 'string' to 'System.Web.UI.WebControls.TextBox'" as i m new to C# programming so i can't resolve it.
 protected void gvCouponDetails_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
    int id;
    int CouponTypeID;
    int Serial_Start;
    int serial_End;
        TextBox CouponName;
    DateTime TranDate;

    GridViewRow row = gvCouponDetails.Rows[e.RowIndex];

    id = int.Parse(((Label)row.Cells[0].FindControl("lblID")).Text);
    TranDate = DateTime.Parse(((TextBox)row.Cells[2].FindControl("tbDate")).Text);
    CouponName =((DropDownList)row.Cells[3].FindControl("ddlCoupon")).SelectedValue.ToString();
    Serial_Start= int.Parse(((TextBox)row.Cells[4].FindControl("tbSerialStart")).Text);
    serial_End = int.Parse(((TextBox)row.Cells[5].FindControl("tbSerialEnd")).Text);

    string UpdateQuery = string.Format("update Coupon_Info Set ReceivingDate = '{0}',Coupon_TypeID = {1}, Serial_Start={2},Serial_End={3} where ID= {4}",TranDate.ToString(),CouponTypeID.ToString(),Serial_Start.ToString(),serial_End.ToString(),id.ToString());
    DAL da = new DAL();
    da.ConnectionString = ConfigurationManager.AppSettings["ConnectionString"].ToString();
    int i= da.ExecuteNonQuery(CommandType.Text, UpdateQuery, null);
    gvCouponDetails.EditIndex = -1;
    boundgridview();
}

ASP code is
<asp:GridView   ID="gvCouponDetails" 
                        runat="server"
                        AutoGenerateColumns="false" 
            onrowcancelingedit="gvCouponDetails_RowCancelingEdit" 
            onrowediting="gvCouponDetails_RowEditing" 
            onrowupdating="gvCouponDetails_RowUpdating"
            DataKeyNames="ID" 
        style="top: 521px; left: 276px; position: absolute; height: 143px; width: 704px">
          <Columns>
            
            <asp:CommandField   ButtonType="Button"
                                CancelText="C"
                                ShowCancelButton="true"
                                EditText="E"
                                ShowEditButton="true"
                                ControlStyle-Width="15px"
                                ControlStyle-Font-Size="10px"
                                ControlStyle-ForeColor="Blue"
                                UpdateText="U"  />

                


                
                <asp:TemplateField HeaderText="Coupon Name">
                    <ItemTemplate>
                        <asp:Label ID="tbCouponName" Text='<%# Bind("CouponName") %>' Width="100px" runat="server" />
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:DropDownList   ID="ddlCoupon" 
                                            DataSourceID="DSCouponType" 
                                            Width="100px" 
                                            DataTextField="CouponName" 
                                            DataValueField="Coupon_TypeID"
                                            runat="server"/>
                    </EditItemTemplate>
                </asp:TemplateField>

		
		<asp:TemplateField HeaderText="Date">
                
                    <ItemTemplate>
                        <asp:Label ID="lblDate" Text='<%# Bind("TransactionDate") %>' runat="server" />
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:TextBox ID="tbDate" Text='<%# Bind("TransactionDate") %>' Width="80px" runat="server" />
                    </EditItemTemplate>
                </asp:TemplateField>



                
                <asp:TemplateField HeaderText="Price">
                    <ItemTemplate>
                        <asp:Label ID="lblprice" Text='<%# Bind("Price") %>' runat="server" Width="80px" />
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:TextBox ID="tbprice" Text='<%# Bind("Price") %>' runat="server"  Width="80px" />
                    </EditItemTemplate>
                </asp:TemplateField>

                
                <asp:TemplateField HeaderText="Serial End">
                    <ItemTemplate>
                        <asp:Label ID="lblSerialEnd" Text='<%# Bind("SerialEnd") %>' runat="server" Width="70px" />
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:TextBox ID="tbSerialEnd"  Text='<%# Bind("SerialEnd") %>' runat="server"  Width="70px"/>
                    </EditItemTemplate>
                </asp:TemplateField>



		<asp:TemplateField HeaderText="Serial Start">
                    <ItemTemplate>
                        <asp:Label ID="lblSerialStart" Text='<%# Bind("SerialStart") %>' runat="server" Width="70px" />
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:TextBox ID="tbSerialStart"  Text='<%# Bind("SerialStart") %>' runat="server"  Width="70px"/>
                    </EditItemTemplate>
                </asp:TemplateField>


                <asp:TemplateField HeaderText="Menu">
                    <ItemTemplate>
                        <asp:Label ID="tbMenu" Text='<%# Bind("Cafe_Menu") %>' Width="100px" runat="server" />
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:DropDownList   ID="ddlmenu" 
                                            DataSourceID="DSMenu" 
                                            Width="100px" 
                                            DataTextField="Cafe_Menu" 
                                            DataValueField="Cafe_Menu"
                                            runat="server"/>
                    </EditItemTemplate>
                </asp:TemplateField>


		<asp:TemplateField HeaderText="Description">
                    <ItemTemplate>
                        <asp:Label ID="lblDes" Text='<%# Bind("Description") %>' runat="server" Width="70px" />
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:TextBox ID="tbDes"  Text='<%# Bind("Description") %>' runat="server"  Width="70px"/>
                    </EditItemTemplate>
                </asp:TemplateField>

		<asp:TemplateField HeaderText="Transaction">
                    <ItemTemplate>
                        <asp:Label ID="lblSerialStart" Text='<%# Bind("Transaction") %>' runat="server" Width="70px" />
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:TextBox ID="tbSerialStart"  Text='<%# Bind("Transaction") %>' runat="server"  Width="70px"/>
                    </EditItemTemplate>
                </asp:TemplateField>
                
                                
            </Columns>
        </asp:GridView>

AnswerRe: Cannot implicitly convert type 'string' to 'System.Web.UI.WebControls.TextBox' Pin
Abhijit Jana24-Aug-09 18:34
professionalAbhijit Jana24-Aug-09 18:34 
GeneralRe: Cannot implicitly convert type 'string' to 'System.Web.UI.WebControls.TextBox' Pin
haleemasher24-Aug-09 18:46
haleemasher24-Aug-09 18:46 
GeneralRe: Cannot implicitly convert type 'string' to 'System.Web.UI.WebControls.TextBox' Pin
Sendilkumar.M24-Aug-09 19:28
Sendilkumar.M24-Aug-09 19:28 
AnswerRe: Cannot implicitly convert type 'string' to 'System.Web.UI.WebControls.TextBox' Pin
ali_reza_zareian24-Aug-09 18:46
ali_reza_zareian24-Aug-09 18:46 
GeneralRe: Cannot implicitly convert type 'string' to 'System.Web.UI.WebControls.TextBox' Pin
haleemasher24-Aug-09 18:54
haleemasher24-Aug-09 18:54 
AnswerRe: Cannot implicitly convert type 'string' to 'System.Web.UI.WebControls.TextBox' Pin
Christian Graus24-Aug-09 19:01
protectorChristian Graus24-Aug-09 19:01 
AnswerRe: Cannot implicitly convert type 'string' to 'System.Web.UI.WebControls.TextBox' Pin
padmanabhan N24-Aug-09 19:04
padmanabhan N24-Aug-09 19:04 
GeneralRe: Cannot implicitly convert type 'string' to 'System.Web.UI.WebControls.TextBox' Pin
Christian Graus24-Aug-09 19:10
protectorChristian Graus24-Aug-09 19:10 
AnswerRe: Cannot implicitly convert type 'string' to 'System.Web.UI.WebControls.TextBox' Pin
harshangrana24-Aug-09 19:54
harshangrana24-Aug-09 19:54 
QuestionA page can have only one server-side Form tag. Pin
haleemasher24-Aug-09 18:15
haleemasher24-Aug-09 18:15 
AnswerRe: A page can have only one server-side Form tag. Pin
Abhijit Jana24-Aug-09 18:31
professionalAbhijit Jana24-Aug-09 18:31 
AnswerRe: A page can have only one server-side Form tag. Pin
Christian Graus24-Aug-09 19:14
protectorChristian Graus24-Aug-09 19:14 
AnswerRe: A page can have only one server-side Form tag. Pin
Sendilkumar.M24-Aug-09 19:31
Sendilkumar.M24-Aug-09 19:31 
QuestionHow to create exe file of C# web project? Pin
nudma24-Aug-09 18:15
nudma24-Aug-09 18:15 
AnswerRe: How to create exe file of C# web project? Pin
Abhijit Jana24-Aug-09 18:28
professionalAbhijit Jana24-Aug-09 18:28 
AnswerRe: How to create exe file of C# web project? Pin
ali_reza_zareian24-Aug-09 18:41
ali_reza_zareian24-Aug-09 18:41 
GeneralRe: How to create exe file of C# web project? Pin
nudma25-Aug-09 4:38
nudma25-Aug-09 4:38 

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.