Click here to Skip to main content
15,896,557 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: how to remove dll reference in visual studio? Pin
Abhijit Jana16-Jan-09 20:55
professionalAbhijit Jana16-Jan-09 20:55 
Questionmerge two pdf Pin
bhaumikdv16-Jan-09 0:11
bhaumikdv16-Jan-09 0:11 
AnswerRe: merge two pdf Pin
SeMartens16-Jan-09 3:45
SeMartens16-Jan-09 3:45 
Question[Message Deleted] Pin
mihirkul15-Jan-09 23:33
mihirkul15-Jan-09 23:33 
AnswerCP IGNORE; repost Pin
leckey16-Jan-09 4:21
leckey16-Jan-09 4:21 
QuestionDatagrid with row movement by mouse clicking Pin
Girish48115-Jan-09 23:12
Girish48115-Jan-09 23:12 
AnswerRe: Datagrid with row movement by mouse clicking Pin
Ashfield16-Jan-09 1:28
Ashfield16-Jan-09 1:28 
QuestionCheckbox in datagrid! Pin
RajpootRohan15-Jan-09 22:37
professionalRajpootRohan15-Jan-09 22:37 
Hi to all,

I have a datagrid and a checkbox in it.In my datagrid I have a template column of "QTY" which is having a textbox.
Suppose user selects an item then it will be displayed in the datagrid.

But if user wants to change the quantity then he has to check the the checkbox and click the update button below datagrid.

for this I did:
<br />
<asp:DataGrid ID="DataGrid2" runat="server" CellPadding="4" ForeColor="#333333" <br />
            GridLines="Horizontal" EnableViewState="False" Font-Bold="True" <br />
            Font-Names="Verdana" Font-Size="Small" AutoGenerateColumns="False" ><br />
            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /><br />
            <EditItemStyle BackColor="#999999" /><br />
            <SelectedItemStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" /><br />
            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" /><br />
            <AlternatingItemStyle BackColor="White" ForeColor="#284775" /><br />
            <ItemStyle BackColor="#F7F6F3" ForeColor="#333333" /><br />
            <Columns><br />
            <asp:TemplateColumn HeaderText="Select" HeaderStyle-Width="50px"><br />
            <ItemTemplate><br />
            <asp:CheckBox ID="chkSelection" runat="server" ToolTip='<%# Eval("QTY") %>' /><br />
            </ItemTemplate><br />
            <HeaderStyle Width="50px"></HeaderStyle><br />
            </asp:TemplateColumn><br />
                <asp:BoundColumn DataField="REF" HeaderStyle-Width="70px" HeaderText="REF"></asp:BoundColumn><br />
                <asp:TemplateColumn HeaderText="product_id" Visible="False"><br />
                <ItemTemplate><br />
                <asp:Label ID="lblProduct_Id" runat="server" Text='<%# Eval("REF") %>'></asp:Label><br />
                </ItemTemplate><br />
                </asp:TemplateColumn><br />
                <asp:BoundColumn DataField="Description" HeaderStyle-Width="330px" HeaderText="Description"></asp:BoundColumn><br />
                <asp:TemplateColumn HeaderText="QTY" HeaderStyle-Width="30px"><br />
                <ItemTemplate><br />
                <asp:TextBox ID="TxtQTY" runat="server" Width="30px" Text='<%# Eval("QTY") %>' /><br />
                </ItemTemplate>               <br />
                </asp:TemplateColumn><br />
                <asp:BoundColumn DataField="Price" HeaderStyle-Width="50px" HeaderText="Price"></asp:BoundColumn><br />
                <asp:BoundColumn DataField="Cost" HeaderStyle-Width="70px" HeaderText="Cost"></asp:BoundColumn><br />
            </Columns><br />
            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /><br />
        </asp:DataGrid><br />


protected void BtnUpdate_Click(object sender, EventArgs e)
{
    CheckBox chkSelected = new CheckBox();

    foreach (DataGridItem dgItem in DataGrid2.Items)
    {
        chkSelected = (CheckBox)dgItem.FindControl("chkSelection");

        if (chkSelected.Checked == true)
        {
            qty3 = Convert.ToInt32(chkSelected.ToolTip);
        }

    }
}


But the problem is that in the code behind file datagrid2.Items has the count=0.So the foreach loop is not working.

Please guide me that where I am making mistake.
Thanks in advance!

cheers,
sneha

AnswerRe: Checkbox in datagrid! Pin
Christian Graus15-Jan-09 23:26
protectorChristian Graus15-Jan-09 23:26 
AnswerRe: Checkbox in datagrid! Pin
Herman<T>.Instance19-Jan-09 3:34
Herman<T>.Instance19-Jan-09 3:34 
QuestionHow to get a particular sub report of any report programaticaly ? Pin
bhaumikdv15-Jan-09 22:20
bhaumikdv15-Jan-09 22:20 
GeneralMVP implementation questions Pin
Nathan Gloyn15-Jan-09 21:59
Nathan Gloyn15-Jan-09 21:59 
GeneralRe: MVP implementation questions Pin
N a v a n e e t h15-Jan-09 23:04
N a v a n e e t h15-Jan-09 23:04 
GeneralRe: MVP implementation questions Pin
Nathan Gloyn16-Jan-09 4:00
Nathan Gloyn16-Jan-09 4:00 
GeneralRe: MVP implementation questions Pin
N a v a n e e t h16-Jan-09 5:05
N a v a n e e t h16-Jan-09 5:05 
GeneralRe: MVP implementation questions Pin
Nathan Gloyn16-Jan-09 5:38
Nathan Gloyn16-Jan-09 5:38 
GeneralRe: MVP implementation questions Pin
Jon Rista16-Jan-09 5:59
Jon Rista16-Jan-09 5:59 
GeneralRe: MVP implementation questions Pin
Nathan Gloyn16-Jan-09 8:50
Nathan Gloyn16-Jan-09 8:50 
GeneralRe: MVP implementation questions Pin
Jon Rista16-Jan-09 9:21
Jon Rista16-Jan-09 9:21 
GeneralRe: MVP implementation questions Pin
Nathan Gloyn16-Jan-09 9:41
Nathan Gloyn16-Jan-09 9:41 
GeneralRe: MVP implementation questions Pin
Jon Rista16-Jan-09 10:02
Jon Rista16-Jan-09 10:02 
GeneralRe: MVP implementation questions Pin
Nathan Gloyn16-Jan-09 10:17
Nathan Gloyn16-Jan-09 10:17 
GeneralRe: MVP implementation questions Pin
Jon Rista16-Jan-09 10:58
Jon Rista16-Jan-09 10:58 
GeneralRe: MVP implementation questions Pin
Nathan Gloyn19-Jan-09 8:25
Nathan Gloyn19-Jan-09 8:25 
GeneralRe: MVP implementation questions Pin
Jon Rista19-Jan-09 9:55
Jon Rista19-Jan-09 9:55 

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.