Button not working when I use update panel - c#

I have 3 bootstrap tabs in a page. In the first and third tab buttons they are not working but a button in the second tab works fine. In the second tab I have an update panel to post back a dropdown because I want to show like bootstrap modal script and a button at second tab is working fine. Can you tell me why it's happening and how can I do this?
My question is very confusing to explain. I want to use about why a button in tab is not working but in the second tab is working fine. And when I do function in second tab finish a button in first tab is working. Why is happening? I am very confused. Thank you very much.
this is code in .aspx with function modal:
<div class="tab-pane fade" id="profile">
<%--modal --%>
<button type="button" id="aaa" data-toggle="modal" data-target="#download" class="btn btn-primary btn-lg">เพิ่มรายการใหม่</button>
<div class="modal fade" id="download" tabindex="-1" role="dialog" aria-labelledby="downloadlabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title" id="downloadlabel">
<asp:Label ID="usrl" runat="server"></asp:Label>
<br />
<asp:Label ID="detail" runat="server"></asp:Label></h4>
</div>
<div class="modal-body">
<p>
<strong>Request Section</strong><br /><br />
</p>
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:Panel ID="Panel1" runat ="server">
<asp:UpdatePanel ID="update" UpdateMode="Conditional" runat="server">
<ContentTemplate>
<div class="formItem">
<div class="form-group">
<asp:Label ID="Label6" runat="server"><b>Item Code: </b></asp:Label>
<asp:TextBox ID="itm_code" CssClass="form-control" runat="server" required="required"></asp:TextBox>
</div>
</div>
<div class="formItem">
<div class="form-group">
<asp:Label ID="Label7" runat="server"><b>Item Description: </b></asp:Label>
<asp:TextBox ID="itm_desc" CssClass="form-control" runat="server" required="required"></asp:TextBox>
</div>
</div>
<div class="formItem">
<div class="form-group">
<asp:Label runat="server"><b>Order Category: </b></asp:Label>
<asp:DropDownList ID="ord_cat" CssClass="form-control" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ord_cat_SelectedIndexChanged">
<asp:ListItem Value="0" Text="Chosse Order Category"></asp:ListItem>
</asp:DropDownList>
</div>
</div>
<div class="formItem">
<div class="form-group">
<asp:Label runat="server"><b>Order Subcategory / Department in Lab: </b></asp:Label>
<asp:DropDownList ID="ord_subCat" CssClass="form-control" runat="server">
<asp:ListItem Value="0" Text="Chosse Order Subcategory"></asp:ListItem>
</asp:DropDownList>
</div>
</div>
<div class="formItem">
<div class="form-group">
<asp:Label ID="Label11" runat="server"><b>Billing Group: </b></asp:Label>
<asp:DropDownList ID="ord_bg" CssClass="form-control" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ord_bg_SelectedIndexChanged">
<asp:ListItem Value="0" Text="Chosse Billing Group"></asp:ListItem>
</asp:DropDownList>
</div>
</div>
<div class="formItem">
<div class="form-group">
<asp:Label ID="Label14" runat="server"><b>Billing SubGroup: </b></asp:Label>
<asp:DropDownList ID="ord_bsg" CssClass="form-control" runat="server">
<asp:ListItem Value="0" Text="Chosse Billing Sub Group"></asp:ListItem>
</asp:DropDownList>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Panel>
<div class="formItem">
<div class="form-group">
<asp:Label runat="server"><b>Service Cat: </b></asp:Label>
<asp:TextBox ID="ord_svc" CssClass="form-control" runat="server"></asp:TextBox>
</div>
</div>
<div class="formItem">
<div class="form-group">
<asp:Label runat="server"><b>Alias Name / Synonym in Lab: </b></asp:Label>
<asp:TextBox ID="ord_asn" CssClass="form-control" runat="server" required="required"></asp:TextBox>
</div>
</div>
<div class="formItem">
<div class="form-group">
<asp:Label runat="server"><b>Cost Price: </b></asp:Label>
<asp:TextBox ID="ord_cp" CssClass="form-control" runat="server" required="required"></asp:TextBox>
</div>
</div>
<div class="formItem">
<div class="form-group">
<div class="form-inline">
<asp:Label runat="server"><b>OPD Price: </b></asp:Label>
<asp:TextBox ID="OPD_price" size="7" CssClass="form-control" runat="server" required="required"></asp:TextBox>
<asp:Label runat="server"><b>IPD Price: </b></asp:Label>
<asp:TextBox ID="IPD_price" size="7" CssClass="form-control" runat="server" required="required"></asp:TextBox>
<asp:Label runat="server"><b>Tourist Price: </b></asp:Label>
<asp:TextBox ID="TOU_price" size="7" CssClass="form-control" runat="server" required="required"></asp:TextBox>
</div>
</div>
</div>
<div class="formItem">
<div class="form-group">
<asp:Label runat="server"><b>File upload</b></asp:Label>
<asp:FileUpload ID="fileupload" runat="server" />
<p class="help-block" style="color: #FF852C">โปรดระบุ เอกสารแนบท้ายเพิ่มเติมกรณี (ถ้ามี)</p>
</div>
</div>
<div class="formItem">
<div class="form-group">
<asp:Label runat="server"><b>Send to DF: </b></asp:Label>
<asp:RadioButtonList ID="ord_sdf" runat="server" CssClass="required">
<asp:ListItem Value="Yes" Text="Yes"></asp:ListItem>
<asp:ListItem Value="No" Text="No"></asp:ListItem>
</asp:RadioButtonList>
<asp:RequiredFieldValidator ID="RequiredFieldValidator" runat="server" ControlToValidate="ord_sdf" ErrorMessage="Please select some other choice.">
</asp:RequiredFieldValidator>
</div>
</div>
<div class="formItem">
<div class="form-group">
<asp:Label runat="server"><b>Remark: </b></asp:Label>
<asp:TextBox ID="ord_rmk" TextMode="MultiLine" CssClass="form-control" runat="server"></asp:TextBox>
</div>
</div>
</div>
<div class="modal-footer">
<asp:Button ID="btn_insert" CssClass="btn btn-danger" Text="INSERT ITEM" runat="server" OnClick="btn_insert_Click" />
<button type="button" class="btn btn-info" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
code in tab 1
<div class="tab-content">
<div class="tab-pane fade in active" id="home">
<div class="search">
<div class="form-inline">
<div class="group-search">
<asp:Label ID="Label12" Text="Item Code : " runat="server" CssClass="control-label" Font-Bold ="true"></asp:Label>
<asp:TextBox ID="search_ic" runat="server" CssClass="form-control"></asp:TextBox>
<asp:Label ID="Label13" Text="Item Description : " runat="server" CssClass="control-label" Font-Bold ="true"></asp:Label>
<asp:TextBox ID="search_id" runat="server" CssClass="form-control"></asp:TextBox>
<asp:Button ID="btn_search" Text="Search" runat="server" CssClass="btn btn-default" OnClick="btn_search_Click" />
<asp:Label ID="txt_alert" Text="กรุณากรอก Item Code หรือ Item Description" runat="server" CssClass="form-control" Visible="false"></asp:Label>
</div>
</div>
</div>
<%--gridview for update--%>
<div class="meddle2">
<asp:GridView ID="gridview" runat="server" AutoGenerateColumns="False"
OnDataBound="gridview_DataBound"
OnRowCancelingEdit="gridview_RowCancelingEdit"
OnRowEditing="gridview_RowEditing" OnRowUpdated="gridview_RowUpdated"
CssClass="table table-hover table-striped">
<Columns>
<asp:CommandField ShowEditButton="True" HeaderStyle-BackColor="#D4E6ED" ControlStyle-CssClass="btn btn-primary" ButtonType="Button" HeaderStyle-Width="80">
<ControlStyle CssClass="btn btn-primary"></ControlStyle>
<HeaderStyle Width="80px"></HeaderStyle>
</asp:CommandField>
<asp:TemplateField HeaderText="No." HeaderStyle-BackColor="#D4E6ED">
<ItemTemplate>
<asp:Label ID="lblnum" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.num") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Item Code" HeaderStyle-BackColor="#D4E6ED">
<ItemTemplate>
<asp:Label ID="lblIC" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.item_code") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txt_ic" runat="server" size="6" CssClass="form-control" Text='<%# DataBinder.Eval(Container, "DataItem.item_code") %>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Item Description" HeaderStyle-BackColor="#D4E6ED">
<ItemTemplate>
<asp:Label ID="lblID" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.item_des") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txt_id" runat="server" size="10" CssClass="form-control" Text='<%# DataBinder.Eval(Container, "DataItem.item_des") %>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Existing OPD Price" HeaderStyle-BackColor="#D4E6ED">
<ItemTemplate>
<asp:Label ID="lblEOP" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.eop") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txt_eop" runat="server" size="10" CssClass="form-control" Text='<%# DataBinder.Eval(Container, "DataItem.eop") %>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Existing IPD Price" HeaderStyle-BackColor="#D4E6ED">
<ItemTemplate>
<asp:Label ID="lblEIP" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.eip") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txt_eip" runat="server" size="10" CssClass="form-control" Text='<%# DataBinder.Eval(Container, "DataItem.eip") %>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Existing Tourist Price" HeaderStyle-BackColor="#D4E6ED">
<ItemTemplate>
<asp:Label ID="lblETP" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.etp") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txt_etp" runat="server" size="10" CssClass="form-control" Text='<%# DataBinder.Eval(Container, "DataItem.etp") %>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="New OPD Price" HeaderStyle-BackColor="#D4E6ED">
<ItemTemplate>
<asp:Label ID="lblNOP" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.nop") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txt_nop" runat="server" size="10" CssClass="form-control" Text='<%# DataBinder.Eval(Container, "DataItem.nop") %>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="New IPD Price" HeaderStyle-BackColor="#D4E6ED">
<ItemTemplate>
<asp:Label ID="lblNIP" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.nip") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txt_nip" runat="server" size="10" CssClass="form-control" Text='<%# DataBinder.Eval(Container, "DataItem.nip") %>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="New Tourist Price" HeaderStyle-BackColor="#D4E6ED">
<ItemTemplate>
<asp:Label ID="lblNTP" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.ntp") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txt_ntp" runat="server" size="10" CssClass="form-control" Text='<%# DataBinder.Eval(Container, "DataItem.ntp") %>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Margin OPD Price" HeaderStyle-BackColor="#D4E6ED">
<ItemTemplate>
<asp:Label ID="lblmop" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.mop") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txt_mop" runat="server" size="10" CssClass="form-control" Text='<%# DataBinder.Eval(Container, "DataItem.mop") %>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Margin IPD Price" HeaderStyle-BackColor="#D4E6ED">
<ItemTemplate>
<asp:Label ID="lblmip" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.mip") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txt_mip" runat="server" size="10" CssClass="form-control" Text='<%# DataBinder.Eval(Container, "DataItem.mip") %>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Margin Tourist Price" HeaderStyle-BackColor="#D4E6ED">
<ItemTemplate>
<asp:Label ID="lblmtp" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.mtp") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txt_mtp" runat="server" size="10" CssClass="form-control" Text='<%# DataBinder.Eval(Container, "DataItem.mtp") %>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:HiddenField ID="hdf" runat="server" />
</div>
</div>

Related

How to populate the selected dropdown values in asp.net

Selected Drop down values are getting NULL but when i try to populate the text i am able to get the values.
HTML Code:
<div class="form-group">
<label>Indent No <font class="star_color"> * </font> </label>
<asp:TextBox ID="txtindentNo" runat="server" Class="form-control"
OnTextChanged="txtindentNo_TextChanged"></asp:TextBox>
</div>
<div class="form-group">
<label>Select Item <font class="star_color"> * </font> </label>
<asp:DropDownList ID="ddlItem" runat="server" class="form-control" AutoPostBack="true" OnSelectedIndexChanged="ddlItem_SelectedIndexChanged">
</asp:DropDownList>
</div>
<asp:TemplateField HeaderText="Indent Number " ItemStyle-HorizontalAlign="center">
<ItemTemplate>
<asp:Label ID="lblIndentNo" runat="server" Text='<%#Eval("IndentNumber") %>' Font-Size="Small"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Item" ItemStyle-HorizontalAlign="Left">
<ItemTemplate>
<asp:Label ID="lblItem" runat="server" Text='<%#Eval("SeedItemNameEng") %>' Font-Size="Small"></asp:Label>
<asp:HiddenField ID="hdnItem" runat="server" Value='<%# Bind("SeedItemID") %>' />
</ItemTemplate>
</asp:TemplateField>
Code:
txtindentNo.Text = ((Label)grdItems.Rows[IndexValue].FindControl("lblIndentNo")).Text.Trim();
ddlItem.SelectedValue = ((Label)grdItems.Rows[IndexValue].FindControl("lblItem")).Text.Trim();

Identifying the selected row count in a Telerik RadGrid

I am using Telerik's RadGrid control in a form, along with a FormView. When I select a row in the RadGrid, the details of the selected row display in the FormView control. There's also a button on the page that, when clicked, changes the mode of the FormView to "Insert", but only if a row in the RadGrid is selected. Otherwise a label should appear. Unfortunately, I can't get the count of selected items in the RadGrid to ever count more than 0. This means that I always see the label text when I click the button, even if a row is selected in the RadGrid.
Here's the RadGrid markup:
<telerik:RadGrid ID="rgInsps" runat="server" DataSourceID="sdsRgInsps" AutoGenerateColumns="False" AllowPaging="True" AllowSorting="True" AllowFilteringByColumn="True" ShowGroupPanel="True" Skin="Default" OnSelectedIndexChanged="rgInsps_SelectedIndexChanged" OnPreRender="rgInsps_PreRender" OnItemCommand="rgInsps_ItemCommand">
<ClientSettings AllowDragToGroup="True" AllowColumnsReorder="True" ReorderColumnsOnClient="True"></ClientSettings>
<MasterTableView DataKeyNames="inspDetIdPk" DataSourceID="sdsRgInsps">
<Columns>
<telerik:GridButtonColumn ButtonType="LinkButton" CommandName="Select" Text="Select"></telerik:GridButtonColumn>
<telerik:GridBoundColumn DataField="inspDetIdPk" ReadOnly="True" HeaderText="inspDetIdPk" SortExpression="inspDetIdPk" UniqueName="inspDetIdPk" DataType="System.Int32" FilterControlAltText="Filter inspDetIdPk column"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="assntIdFk" HeaderText="assntIdFk" SortExpression="assntIdFk" UniqueName="assntIdFk" DataType="System.Int32" FilterControlAltText="Filter assntIdFk column" HeaderStyle-HorizontalAlign="Center" HeaderStyle-Font-Bold="false" ItemStyle-HorizontalAlign="Center"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="inspDt" HeaderText="Inspection Date" DataFormatString="{0:MM/dd/yyyy}" SortExpression="inspDt" UniqueName="inspDt" DataType="System.DateTime" FilterControlAltText="Filter inspDt column" HeaderStyle-HorizontalAlign="Center" HeaderStyle-Font-Bold="false" ItemStyle-HorizontalAlign="Center"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="inspContDt" HeaderText="Contact Date" DataFormatString="{0:MM/dd/yyyy}" SortExpression="inspContDt" UniqueName="inspContDt" DataType="System.DateTime" FilterControlAltText="Filter inspContDt column" HeaderStyle-HorizontalAlign="Center" HeaderStyle-Font-Bold="false" ItemStyle-HorizontalAlign="Center"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="contType" HeaderText="Contact Type" SortExpression="contType" UniqueName="contType" FilterControlAltText="Filter contType column" HeaderStyle-HorizontalAlign="Center" HeaderStyle-Font-Bold="false" ItemStyle-HorizontalAlign="Center"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="inspContFN" HeaderText="First Name" SortExpression="inspContFN" UniqueName="inspContFN" FilterControlAltText="Filter inspContFN column" HeaderStyle-HorizontalAlign="Center" HeaderStyle-Font-Bold="false" ItemStyle-HorizontalAlign="Center"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="inspContLN" HeaderText="Last Name" SortExpression="inspContLN" UniqueName="inspContLN" FilterControlAltText="Filter inspContLN column" HeaderStyle-HorizontalAlign="Center" HeaderStyle-Font-Bold="false" ItemStyle-HorizontalAlign="Center"></telerik:GridBoundColumn>
</Columns>
</MasterTableView>
</telerik:RadGrid>
Here's the FormView markup:
<asp:FormView ID="fvInspsDets"
runat="server"
DataKeyNames="inspDetIdPk"
DataSourceID="sdsFvInspDets"
OnItemCommand="fvInspsDets_ItemCommand"
OnItemUpdated="fvInspsDets_ItemUpdated"
OnItemInserted="fvInspsDets_ItemInserted"
OnItemDeleted="fvInspsDets_ItemDeleted">
<EditItemTemplate>
<asp:Label Text='<%# Eval("inspDetIdPk") %>' runat="server" ID="inspDetIdPkLabel1" Visible="false" />
<asp:TextBox Text='<%# Bind("assntIdFk") %>' runat="server" ID="assntIdFkTextBox" Visible="false" />
<asp:TextBox Text='<%# Bind("inspDetUpldBy") %>' runat="server" ID="inspDetUpldByTextBox" Visible="false" />
<div class="row">
<div class="col-xs-12 col-sm-6 col-md-3 col-lg-3 form-group">
<strong>Contact Date & Time</strong><br />
<asp:TextBox ID="inspContDtTextBox" runat="server" Text='<%# Bind("inspContDt", "{0:MM/dd/yyyy}") %>' CssClass="form-control"></asp:TextBox>
<ajaxToolkit:CalendarExtender ID="cdInspContDtTextBox" runat="server" TargetControlID="inspContDtTextBox" Format="MM/dd/yyyy" />
</div>
<div class="col-xs-12 col-sm-6 col-md-3 col-lg-3 form-group">
<strong>Contact Type</strong><br />
<asp:DropDownList SelectedValue='<%# Bind("inspContType") %>' runat="server" ID="inspContTypeDdl" CssClass="form-control" AppendDataBoundItems="true" DataSourceID="sdsContTypes" DataTextField="contType" DataValueField="contTypeIdPk"><asp:ListItem Value="">--Please Select--</asp:ListItem></asp:DropDownList>
</div>
<div class="col-xs-12 col-sm-6 col-md-3 col-lg-3 form-group">
<strong>Contact's First Name</strong><br />
<asp:TextBox Text='<%# Bind("inspContFN") %>' runat="server" ID="inspContFNTextBox" CssClass="form-control" />
</div>
<div class="col-xs-12 col-sm-6 col-md-3 col-lg-3 form-group">
<strong>Contact's Last Name</strong><br />
<asp:TextBox Text='<%# Bind("inspContLN") %>' runat="server" ID="inspContLNTextBox" CssClass="form-control" />
</div>
<div class="col-xs-12 col-sm-6 col-md-3 col-lg-3 form-group">
<strong>Inspection Date & Time</strong><br />
<asp:TextBox ID="inspDtTextBox" runat="server" Text='<%# Bind("inspDt", "{0:MM/dd/yyyy}") %>' CssClass="form-control"></asp:TextBox>
<ajaxToolkit:CalendarExtender ID="ceInspDtTextBox" runat="server" TargetControlID="inspDtTextBox" Format="MM/dd/yyyy" />
</div>
<div class="col-xs-12 col-sm-6 col-md-3 col-lg-3 form-group">
<strong>Inspection Rescheduled</strong><br />
<asp:CheckBox Checked='<%# Bind("inspResched") %>' runat="server" ID="inspReschedCheckBox" />
</div>
</div>
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 form-group">
<strong>Note(s)</strong><br />
<asp:TextBox Text='<%# Bind("inspNote") %>' runat="server" ID="inspNoteTextBox" CssClass="form-control" Rows="3" TextMode="MultiLine" />
</div>
</div>
<asp:LinkButton runat="server" Text="Update" CommandName="Update" ID="UpdateButton" CausesValidation="True" CssClass="btn btn-success btn-sm" />
<asp:LinkButton runat="server" Text="Cancel" CommandName="Cancel" ID="UpdateCancelButton" CausesValidation="False" CssClass="btn btn-danger btn-sm" />
</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBox Text='<%# Bind("assntIdFk") %>' runat="server" ID="assntIdFkTextBox" Visible="false" />
<asp:TextBox Text='<%# Bind("inspDetUpldBy") %>' runat="server" ID="inspDetUpldByTextBox" Visible="false" />
<div class="row">
<div class="col-xs-12 col-sm-6 col-md-3 col-lg-3 form-group">
<strong>Contact Date & Time</strong><br />
<telerik:RadDateTimePicker ID="rdtpInspContDt" runat="server" DbSelectedDate='<%# Bind("inspContDt") %>' Skin="Default" CssClass="form-control" ></telerik:RadDateTimePicker>
</div>
<div class="col-xs-12 col-sm-6 col-md-3 col-lg-3 form-group">
<strong>Contact Type</strong><br />
<asp:DropDownList SelectedValue='<%# Bind("inspContType") %>' runat="server" ID="inspContTypeDdl" CssClass="form-control" AppendDataBoundItems="true" DataSourceID="sdsContTypes" DataTextField="contType" DataValueField="contTypeIdPk"><asp:ListItem Value="">--Please Select--</asp:ListItem></asp:DropDownList>
</div>
<div class="col-xs-12 col-sm-6 col-md-3 col-lg-3 form-group">
<strong>Contact's First Name</strong><br />
<asp:TextBox Text='<%# Bind("inspContFN") %>' runat="server" ID="inspContFNTextBox" CssClass="form-control" />
</div>
<div class="col-xs-12 col-sm-6 col-md-3 col-lg-3 form-group">
<strong>Contact's Last Name</strong><br />
<asp:TextBox Text='<%# Bind("inspContLN") %>' runat="server" ID="inspContLNTextBox" CssClass="form-control" />
</div>
<div class="col-xs-12 col-sm-6 col-md-3 col-lg-3 form-group">
<strong>Inspection Date & Time</strong><br />
<telerik:RadDateTimePicker ID="rdtpInspDt" runat="server" DbSelectedDate='<%# Bind("inspDt") %>' CssClass="form-control"></telerik:RadDateTimePicker>
</div>
<div class="col-xs-12 col-sm-6 col-md-3 col-lg-3 form-group">
<strong>Inspection Rescheduled</strong><br />
<asp:CheckBox Checked='<%# Bind("inspResched") %>' runat="server" ID="inspReschedCheckBox" />
</div>
</div>
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 form-group">
<strong>Note(s)</strong><br />
<asp:TextBox Text='<%# Bind("inspNote") %>' runat="server" ID="inspNoteTextBox" CssClass="form-control" Rows="3" TextMode="MultiLine" />
</div>
</div>
<asp:LinkButton runat="server" Text="Insert" CommandName="Insert" ID="InsertButton" CausesValidation="True" CssClass="btn btn-success btn-sm" />
<asp:LinkButton runat="server" Text="Cancel" CommandName="Cancel" ID="InsertCancelButton" CausesValidation="False" CssClass="btn btn-danger btn-sm" />
</InsertItemTemplate>
<ItemTemplate>
<asp:Label Text='<%# Eval("inspDetIdPk") %>' runat="server" ID="inspDetIdPkLabel" Visible="false" />
<asp:Label Text='<%# Bind("assntIdFk") %>' runat="server" ID="assntIdFkLabel" Visible="false" />
<asp:Label Text='<%# Bind("inspDetUpldBy") %>' runat="server" ID="inspDetUpldByLabel" Visible="false" />
<div class="row">
<div class="col-xs-12 col-sm-6 col-md-3 col-lg-3 form-group">
<strong>Contact Date & Time</strong><br />
<asp:Label Text='<%# Bind("inspContDt") %>' runat="server" ID="inspContDtLabel" CssClass="form-control" />
</div>
<div class="col-xs-12 col-sm-6 col-md-3 col-lg-3 form-group">
<strong>Contact Type</strong><br />
<asp:Label Text='<%# Bind("contType") %>' runat="server" ID="inspContTypeLabel" CssClass="form-control" />
</div>
<div class="col-xs-12 col-sm-6 col-md-3 col-lg-3 form-group">
<strong>Contact's First Name</strong><br />
<asp:Label Text='<%# Bind("inspContFN") %>' runat="server" ID="inspContFNLabel" CssClass="form-control" />
</div>
<div class="col-xs-12 col-sm-6 col-md-3 col-lg-3 form-group">
<strong>Contact's Last Name</strong><br />
<asp:Label Text='<%# Bind("inspContLN") %>' runat="server" ID="inspContLNLabel" CssClass="form-control" />
</div>
<div class="col-xs-12 col-sm-6 col-md-3 col-lg-3 form-group">
<strong>Inspection Date & Time</strong><br />
<asp:Label Text='<%# Bind("inspDt") %>' runat="server" ID="inspDtLabel" CssClass="form-control" />
</div>
<div class="col-xs-12 col-sm-6 col-md-3 col-lg-3 form-group">
<strong>Rescheduled</strong><br />
<asp:CheckBox Checked='<%# Bind("inspResched") %>' runat="server" ID="inspReschedCheckBox" Enabled="false" />
</div>
</div>
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 form-group">
<strong>Note(s)</strong><br />
<asp:Label Text='<%# Bind("inspNote") %>' runat="server" ID="inspNoteLabel" />
</div>
</div>
<asp:LinkButton runat="server" Text="Edit" CommandName="Edit" ID="EditButton" CausesValidation="False" CssClass="btn btn-primary btn-sm" />
<asp:LinkButton runat="server" Text="Delete" CommandName="Delete" ID="DeleteButton" CausesValidation="False" CssClass="btn btn-danger btn-sm" />
<asp:LinkButton runat="server" Text="New" CommandName="New" ID="NewButton" CausesValidation="False" CssClass="btn btn-success btn-sm" />
</ItemTemplate>
</asp:FormView>
Here's the label:
<asp:Label ID="fvInspsDetsLbl" runat="server"></asp:Label>
Here's the button:
<asp:Button ID="btnRvInspsDetsInsert"
runat="server"
Text="ADD A NEW INSPECTION"
CssClass="btn btn-default btn-sm pull-right"
OnClick="btnRvInspsDetsInsert_Click"
CausesValidation="false" />
Here's the click event code for the button:
if (rgAssnmtList.SelectedItems.Count > 0)
{
fvInspsDets.ChangeMode(FormViewMode.Insert);
}
else
{
fvInspsDetsLbl.Text = "Please select an assignment from the table at the top of the screen.";
fvInspsDetsLbl.ForeColor = System.Drawing.ColorTranslator.FromHtml("#CA2823");
}
Any help on identifying the selected item count of the RadGrid is greatly appreciated.
I am using VS2017, Asp.NET WebForms C# along with Telerik products (thus the RadGrid).
Use radGridView1.SelectedCells.Count to get selected cells, or radGridView1.SelectedRows.Count
Also use RowInfo and ColumnInfo to access the selected row and column.
Check this sample code:
this.radGridView1.MasterTemplate.BeginUpdate();
int count = this.radGridView1.SelectedCells.Count;
for (int i = 0; i < count; i++)
{
GridViewRowInfo row = this.radGridView1.SelectedCells[i].RowInfo;
GridViewColumn column = this.radGridView1.SelectedCells[i].ColumnInfo;
string text = Convert.ToString(this.radGridView1.SelectedCells[i].ColumnInfo.HeaderText);
GridViewCellInfo cell = this.radGridView1.SelectedCells[i];
double val = Convert.ToDouble(cell.Value);
}
this.radGridView1.MasterTemplate.EndUpdate();

Insert data quarterly into SQL Server table from C#

I am creating a web app in C#, I have a dropdownlist like this
<asp:DropDownList ID="droptaskrpt" AutoPostBack="true" CssClass="form-control" OnTextChanged="droptaskrpt_TextChanged" runat="server">
<asp:ListItem Selected="True">Select</asp:ListItem>
<asp:ListItem>Weekly</asp:ListItem>
<asp:ListItem>Quarterly</asp:ListItem>
<asp:ListItem>Half Yearly</asp:ListItem>
<asp:ListItem>Yearly</asp:ListItem>
</asp:DropDownList>
If a user selects quarterly, the same data should be re-insert into the table with same value after a quarter.
I am not able to understand what I need to do here:
I will write the code on pageload
how can I validate the quarter?
how can I insert the same data into the table?
I need your help
<div class="panel-body" style="min-height: 500px;">
<div class="row">
<div class="col-sm-12">
<div class="row">
<div class="col-sm-6">
<div class="form-group" style="margin-top: 2px">
<asp:HiddenField ID="hfTask" runat="server" />
<asp:HiddenField ID="hfParentId" runat="server" />
<%--<asp:CheckBox ID="chkmulti" runat="server" Text="Assign to Group" AutoPostBack="true" ValidationGroup="grp" />--%>
<br />
<div runat="server" id="divuserSelect">
<asp:DropDownList ID="ddlUser" runat="server" CssClass="form-control"></asp:DropDownList>
</div>
<div runat="server" id="divmultiSelect" visible="false">
<asp:TextBox ID="txtCustomer" Text="Select Customers" runat="server" CssClass="form-control"></asp:TextBox>
<asp:Panel ID="PnlCust" runat="server" CssClass="PnlDesign">
<asp:CheckBoxList ID="cblCustomerList" runat="server">
<asp:ListItem>Customer One</asp:ListItem>
<asp:ListItem>Customer Two</asp:ListItem>
<asp:ListItem>Customer Three</asp:ListItem>
</asp:CheckBoxList>
</asp:Panel>
<asp:PopupControlExtender ID="PceSelectCustomer" runat="server" TargetControlID="txtCustomer"
PopupControlID="PnlCust" Position="Bottom">
</asp:PopupControlExtender>
</div>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
Task Title
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" ValidationGroup="OnUpdate" runat="server" Text="*" CssClass="error" ControlToValidate="txtTaskTitle"></asp:RequiredFieldValidator>
<asp:TextBox ID="txtTaskTitle" runat="server" CssClass="form-control"></asp:TextBox>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-4">
<div class="form-group" style="margin-top: 7px">
Start Date
<asp:TextBox ID="txtStartDate" runat="server" CssClass="form-control"></asp:TextBox>
<asp:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="txtStartDate" Format="dd MMM yyyy"></asp:CalendarExtender>
</div>
</div>
<div class="col-sm-2">
<div class="form-group">
Start Time
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" ValidationGroup="OnUpdate" runat="server" Text="*" CssClass="error" ControlToValidate="txtStartTime"></asp:RequiredFieldValidator>
<asp:TextBox ID="txtStartTime" runat="server" CssClass="form-control"></asp:TextBox>
<asp:MaskedEditExtender ID="MaskedEditExtender2" runat="server" TargetControlID="txtStartTime" MaskType="Time" AcceptAMPM="true"
Mask="99:99" ErrorTooltipEnabled="true" />
<h4 style="font-size: x-small">Type A or P to switch AM/PM</h4>
</div>
</div>
<div class="col-sm-4">
<div class="form-group" style="margin-top: 7px">
End Date
<asp:TextBox ID="txtEndDate" runat="server" CssClass="form-control"></asp:TextBox>
<asp:CalendarExtender ID="CalendarExtender2" runat="server" TargetControlID="txtEndDate" Format="dd MMM yyyy"></asp:CalendarExtender>
</div>
</div>
<div class="col-sm-2">
<div class="form-group">
End Time
<asp:RequiredFieldValidator ID="RequiredFieldValidator4" ValidationGroup="OnUpdate" runat="server" Text="*" CssClass="error" ControlToValidate="txtEndTime"></asp:RequiredFieldValidator>
<asp:TextBox ID="txtEndTime" runat="server" CssClass="form-control"></asp:TextBox>
<asp:MaskedEditExtender ID="MaskedEditExtender1" runat="server" TargetControlID="txtEndTime" MaskType="Time" AcceptAMPM="true"
Mask="99:99" ErrorTooltipEnabled="true" />
<h4 style="font-size: x-small">Type A or P to switch AM/PM</h4>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<div class="form-group">
Description
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" ValidationGroup="OnUpdate" runat="server" Text="*" CssClass="error" ControlToValidate="txtDescription"></asp:RequiredFieldValidator>
<asp:TextBox ID="txtDescription" runat="server" TextMode="MultiLine" Height="100" CssClass="form-control"></asp:TextBox>
</div>
</div>
<%-- checklist for week days --%>
<div class="col-sm-6">
<h4>Task Repeat</h4>
<asp:DropDownList ID="droptaskrpt" AutoPostBack="true" CssClass="form-control" OnTextChanged="droptaskrpt_TextChanged" runat="server">
<asp:ListItem Selected="True">Select</asp:ListItem>
<asp:ListItem>Weekly</asp:ListItem>
<asp:ListItem>Quarterly</asp:ListItem>
<asp:ListItem>Half Yearly</asp:ListItem>
<asp:ListItem>Yearly</asp:ListItem>
</asp:DropDownList>
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<asp:CheckBoxList ID="chkWeek" Visible="false" runat="server" CssClass="checkbox-inline">
<asp:ListItem Value="1">Monday</asp:ListItem>
<asp:ListItem Value="2">Tuesday</asp:ListItem>
<asp:ListItem Value="3">Wednesday</asp:ListItem>
</asp:CheckBoxList>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<asp:CheckBoxList ID="CheckBoxList1" Visible="false" runat="server" CssClass="checkbox-inline">
<asp:ListItem Value="4">Thursday</asp:ListItem>
<asp:ListItem Value="5">Friday</asp:ListItem>
<asp:ListItem Value="6">Saturday</asp:ListItem>
<%--<asp:ListItem Value="7">Sunday</asp:ListItem>--%>
</asp:CheckBoxList>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<br />
<div class="form-group">
<asp:FileUpload ID="fpTask" runat="server" CssClass="btn btn-block btn-warning" />
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" ValidationExpression="([a-zA-Z0-9\s_\\.$&*##()+\-:])+(.doc|.docx|.pdf|.jpg|.png|.jpeg|.xls|.xlsx|.txt|.gif)$"
ControlToValidate="fpTask" runat="server" ForeColor="Red" ErrorMessage="selected file is not valid"
Display="Dynamic" />
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<div class="form-group">
Task Priority
<asp:DropDownList runat="server" ID="ddlPriority" CssClass="form-control">
<asp:ListItem Value="Low">Low</asp:ListItem>
<asp:ListItem Value="Medium">Medium</asp:ListItem>
<asp:ListItem Value="High">High</asp:ListItem>
</asp:DropDownList>
</div>
</div>
</div>
<%--<div class="row" runat="server" id="divuser">
<div class="col-sm-6">
<div class="form-group">
User Feedback
<asp:TextBox ID="txtUserFeedBack" runat="server" class="form-control"></asp:TextBox>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<asp:CheckBox ID="chkIsUserClose" runat="server" CssClass="checkbox-inline" Text="Close By User" />
</div>
</div>
</div>--%>
<%--<div class="row" runat="server" id="divadmin">
<div class="col-sm-6">
<div class="form-group">
Admin Feedback
<asp:TextBox ID="txtAdminFeedback" runat="server" class="form-control"></asp:TextBox>
</div>
</div>
<div class="col-sm-6" style="margin-top: 17px">
<div class="form-group">
<asp:CheckBox ID="chkIsAdminClose" runat="server" CssClass="checkbox-inline" Text="Close by Admin" />
</div>
</div>
</div>--%>
<%--<div class="row" runat="server" id="divrating">
<div class="col-sm-6">
<div class="form-group">
Rating
<asp:TextBox ID="txtRating" runat="server" CssClass="form-control"></asp:TextBox>
</div>
</div>
</div>--%>
</div>
</div>
<div class="row">
<div class="col-sm-3">
<%--<asp:ImageButton ID="btnRefresh" runat="server" ImageUrl="~/Content/Images/refresh.png" />--%>
</div>
<div class="col-sm-3">
<asp:Button ID="btnUpdate" runat="server" CssClass="btn btn-primary btn-lg" Text="Update" ValidationGroup="OnUpdate" OnClick="btnUpdate_Click" />
</div>
</div>
<div>
<asp:GridView CssClass="Grid" ID="dgvTask" runat="server" AutoGenerateColumns="false" AllowPaging="true" PageSize="10" OnPageIndexChanging="dgvTask_PageIndexChanging" OnRowDeleting="dgvTask_RowDeleting">
<Columns>
<asp:TemplateField Visible="false">
<ItemTemplate>
<asp:Label runat="server" ID="lblTaskId" Text='<%# Eval("TaskAutoId") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Sr.No">
<ItemTemplate>
<asp:Label runat="server" ID="lblSrNo" Text='<%# Eval("SrNo") %>'></asp:Label>
</ItemTemplate>
<ItemStyle Width="5%" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Task">
<ItemTemplate>
<asp:Label runat="server" ID="lblTask" Text='<%# Eval("TaskName")+": "+Eval("TaskDescription") %>'></asp:Label>
</ItemTemplate>
<ItemStyle Width="50%" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Assign To">
<ItemTemplate>
<asp:Label runat="server" ID="lblAssignTo" Text='<%# Eval("AssignTo") %>'></asp:Label>
</ItemTemplate>
<ItemStyle Width="10%" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Start Date">
<ItemTemplate>
<asp:Label runat="server" ID="lblTaskAssignDate" Text='<%# Eval("AssignDate") %>'></asp:Label>
</ItemTemplate>
<ItemStyle Width="10%" />
</asp:TemplateField>
<asp:TemplateField HeaderText="End Date">
<ItemTemplate>
<asp:Label runat="server" ID="lblTaskEndDate" Text='<%# Eval("EndDate") %>'></asp:Label>
</ItemTemplate>
<ItemStyle Width="10%" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Action">
<ItemTemplate>
<asp:LinkButton ID="lnkDelete" runat="server" CommandName="Delete" Text="Delete" CssClass="action" />
</ItemTemplate>
<ItemStyle Width="10%" />
</asp:TemplateField>
</Columns>
<PagerStyle CssClass="paging" />
</asp:GridView>
</div>
<br />
</div>
all the required html objects

How to get image from GridView using GridView_RowCommand event in c# ASP.NET

i am doing edit operation inside GridView using c# ASP.NET.i need when user will click on edit button all data will retrive from that row and display in text box but here i am unable to display the image.I am explaining my code below.
faq.aspx:
<div class="row">
<div class="col-md-6">
<label for="question" accesskey="T"><span class="required">*</span> Question</label>
<asp:TextBox ID="TextBox1" runat="server" size="30" value="" name="question" ></asp:TextBox>
<div id="noty" style="display:none;" runat="server"></div>
<label for="answer" accesskey="A"><span class="required">*</span> Answer</label>
<asp:TextBox ID="TextBox2" runat="server" size="30" value="" name="answer" ></asp:TextBox>
<div id="Div1" style="display:none;" runat="server"></div>
</div>
<div class="col-md-6 bannerimagefile">
<label for="insertimage" accesskey="B"><span class="required">*</span> Insert Image</label>
<asp:FileUpload runat="server" class="filestyle" data-size="lg" name="insertimage" id="FileUpload1" onchange="previewFile()" />
<label for="bannerimage" accesskey="V"><span class="required">*</span> View Image</label>
<div style="padding-bottom:10px;">
<asp:Image ID="Image3" runat="server" border="0" name="bannerimage" style="width:70px; height:70px;" />
</div>
<div class="clear"></div>
<asp:Button ID="Button1" runat="server" Text="Submit" class="submit"
onclick="Button1_Click" />
</div>
</div>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false" Width="100%" CssClass="table table-striped table-bordered margin-top-zero" OnRowCommand="GridView1_RowCommand" >
<Columns>
<asp:TemplateField HeaderText="Sl No">
<ItemTemplate>
<asp:Label ID="faqid" runat="server" Text='<%#Eval("FAQ_ID") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Question" >
<ItemTemplate>
<asp:Label ID="question" runat="server" Text='<%#Eval("Question") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Answer" >
<ItemTemplate>
<asp:Label ID="answer" runat="server" Text='<%#Eval("Answer") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Image" >
<ItemTemplate>
<asp:Image ID="Image1" runat="server" border="0" name="bannerimage" style="width:70px; height:70px;" ImageUrl='<%# "/Upload/" + Convert.ToString(Eval("Image")) %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Action" >
<ItemTemplate>
<!--</i>
<i class="fa fa-times"></i> -->
<asp:HyperLink ID="HyperLink1" runat="server" data-toggle="tooltip" title="" class="btn btn-xs btn-success" data-original-title="Edit" CommandName="DoEdit" CommandArgument='<%# Eval("FAQ_ID") %>' ><i class="fa fa-edit"></i></asp:HyperLink>
<asp:HyperLink ID="HyperLink2" runat="server" data-toggle="tooltip" title="" class="btn btn-xs btn-danger" data-original-title="Delete" CommandName="DoDelete" CommandArgument='<%# Eval("FAQ_ID") %>' ><i class="fa fa-times"></i></asp:HyperLink>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
faq.aspx.cs:
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
int faqID = int.Parse(e.CommandArgument.ToString());
switch (e.CommandName)
{
case "doEdit":
{
int index = Convert.ToInt32(e.CommandArgument);
TextBox1.Text = GridView1.Rows[index].Cells[1].Text;
TextBox2.Text = GridView1.Rows[index].Cells[2].Text;
HiddenField1.Value = GridView1.Rows[index].Cells[0].Text;
Image3.ImageUrl=
Button1.Text = "Update";
}
}
}
Here i need the image will retrive and set to image3 id.Please help me to solve this issue.
WHere is image3; it's not in your snippet. Please include that, but if it's in the grid, then you do:
var img3 = (Image)GridView1.Rows[index].Cells[X].FindControl("Image3");
img3.ImageUrl = "XYZ";
Direct references only work when on the page outside of a container. If inside a container, you have to use FindControl (such as detailsview.findcontrol) or if a repeatable list, you have to use FindControl from the row (or in the case of the grid, the cell).
Get row index like this:
GridViewRow gvr = (GridViewRow)(((HyperLink)e.CommandSource).NamingContainer);
int index= gvr.RowIndex;
// to get image url
string url = ((Image)gvr.FindControl("Image3")).ImageUrl;
Image3.ImageUrl= url;

Set values always customized to gridview in asp.net c#

need to fill a gridview via code (C#) and want to know how I define the values ​​for components declared inside of it, like labels, buttons and linkbuttons.
Below is an example of a component that would fill and I'm not getting:
<asp:Label ID="lbCodigo" CssClass="label label-inverse" runat="server" Text='<%#Eval("CODIGO") %>'></asp:Label>
Below is the complete gridview:
<asp:GridView ID="gridContatos" runat="server" AutoGenerateColumns="False" Width="100%" OnRowCommand="gridContatos_RowCommand" OnRowDataBound="gridContatos_RowDataBound" CssClass="table table-condensed" BorderWidth="1px" CellPadding="3" GridLines="Vertical">
<AlternatingRowStyle BackColor="#c0c0c0" />
<Columns>
<asp:TemplateField HeaderText="CAIXA DE ENTRADA - FALE CONOSCO">
<ItemTemplate>
<div class="container">
<div class="row-fluid">
<div class="span2">
<div class="">
<div class="alert label-inverse">
<asp:Label ID="lblbAutor" CssClass="label label-info" runat="server" Text='<%#Eval("NOME") %>'></asp:Label>
</div>
</div>
</div>
<div class="span7">
<div class="">
<div class="alert label-inverse">
<asp:Label ID="lbAssunto" CssClass="label label-success" runat="server" Text='<%#Eval("ASSUNTO") %>'></asp:Label>
</div>
</div>
</div>
<div class="span3">
<div class="alert label-inverse">
<asp:LinkButton ID="lbVisualizar" CssClass="label label-success" Visible="true" runat="server" Text="VER" ToolTip="Responder" CommandName="Visualizar" CommandArgument='<%# Container.DataItemIndex%>' />
<%--<asp:ImageButton ID="imgVisualizar" runat="server" ImageUrl="~/Images/zomin_128x128.png" Width="20px" Height="25%" ToolTip="Responder" CommandName="Visualizar" CommandArgument='<%# Container.DataItemIndex%>' />--%>
<asp:LinkButton ID="lbResponder" runat="server" CssClass="label label-inverse" ToolTip="Responder" Visible="true" Text="RESPONDER" CommandName="Responder" CommandArgument='<%# Container.DataItemIndex%>' />
<asp:LinkButton ID="lbExcluir" runat="server" CssClass="label label-warning" Visible="true" Text="EXCLUIR" ToolTip="Excluir" CommandName="Excluir" CommandArgument='<%# Container.DataItemIndex%>' />
</div>
</div>
</div>
</div>
<br />
<asp:Panel ID="pnMensagem" runat="server" CommandArgument='<%# Container.DataItemIndex%>' Visible=" false">
<hr />
<div class="container">
<div class="row">
<div class="span4">
<div class="caption">
<asp:Label ID="lbCodigo" CssClass="label label-inverse" runat="server" Text='<%#Eval("CODIGO") %>'></asp:Label>
<br />
<asp:Label ID="lbData" CssClass="label label-inverse" runat="server" Text='<%#Eval("DATAENVIO") %>'></asp:Label>
<br />
<asp:Label ID="lbEmail" CssClass="label label-inverse" runat="server" Text='<%#Eval("EMAIL") %>'></asp:Label>
<br />
<asp:Label ID="lbTelefone" CssClass="label label-success" runat="server" Text='<%#Eval("TELEFONE") %>'></asp:Label>
<br />
<asp:Label ID="lbEndereco" CssClass="label label-success" runat="server" Text='<%#Eval("ENDERECO") %>'></asp:Label>
<br />
<asp:Label ID="lbCidade" CssClass="label label-success" runat="server" Text='<%#Eval("CIDADE") %>'></asp:Label>
<%-- <br />
<asp:Label ID="lbCelular" CssClass="label label-inverse" runat="server" Text='<%#Eval("celular") %>'></asp:Label>--%>
</div>
</div>
<div class="span8">
<div class="caption">
<asp:TextBox Width="95%" ID="txtMensagem" runat="server" Text='<%#Eval("MENSAGEM") %>' Enabled="false" TextMode="MultiLine"
Rows="5"></asp:TextBox>
</div>
</div>
</div>
</div>
</asp:Panel>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<FooterStyle />
<HeaderStyle />
<PagerStyle HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" />
<SortedAscendingCellStyle />
<SortedAscendingHeaderStyle />
<SortedDescendingCellStyle />
<SortedDescendingHeaderStyle />
</asp:GridView>
I did not understood your question well but i hope this is what you are asking for .
<asp:Label ID="lbCodigo" CssClass="label label-inverse" runat="server" Text='<%#Bind("CODIGO") %>'></asp:Label>

Categories