Forms Data Controls :: Gridview Check Missing 1st One With Gridview Helper Classes

Feb 23, 2010

im reading checkbox value which is checked on my gridview but as per my code is missing the 1st one which on top but i select from the middle then it is working fine here is link for gridviewhelper classes [URL] and im calling this code from gridviewhelper classes on page load event

Dim helper As New GridViewHelper(Me.GridView2)
helper.RegisterGroup("heading", True, True)
AddHandler helper.GroupHeader, AddressOf helper_GroupHeader

and here is my code

Dim sc As New StringCollection()
Dim id As String = String.Empty
For i As Integer = 0 To GridView2.Rows.Count - 1
'loop the GridView Rows
Dim cb As CheckBox = DirectCast(GridView2.Rows(i).Cells(2).FindControl("CheckBox2"), CheckBox)
'find the CheckBox
If cb IsNot Nothing Then
If cb.Checked Then
id = GridView2.Rows(i).Cells(1).Text
sc.Add(id)
MsgBox(id)
End If
End If
Next

View 1 Replies


Similar Messages:

Forms Data Controls :: Uncheck And Check The Check Box Inside Gridview Using Button?

Nov 12, 2010

i have a UP and DOWN buttons ouside a gridview and a checkbox inside the templated field .I will check the checkbox to sleect a row , after that if i click on UP button the checkbox above the selected checkbox should be selected.

same with when i click on DOWN button the checkbox below the selected checkbox should be selected.

View 2 Replies

Forms Data Controls :: Uncheck / Check A Check Box Inside The Gridview

Jan 6, 2010

I have a grid view with two columns...one column has a no. like (123) and a check box....which user can checked or unchecked......all I need to do is that I need to disable the man handling of that check box......rather I would like to see a seperate grid view with the same no. of rows as of the first and in this gridview I may allow to type in or scan the no. and if this scanned or typed number matches any no. in the first gridview number then the corresponding check box should be checked/unchecked.

View 1 Replies

Forms Data Controls :: Gridview Fired Sorting Event Without Handle On Statement "helper.ApplyGroupSort()

Jan 25, 2010

I have problem with gridview sorting. I am using online example to sort a grid view. see the link [URL] but I always got an error "The gridview fired sorting event without handle" on this statement "helper.ApplyGroupSort();"

<table width="100%">
<tr>
<td colspan=3><asp:Label id="category_name" Runat="server"
ForeColor="#ff0000" Font-Bold=true /></td>
</tr>
<tr>
<td colspan="3" align="center" width="100%">
<asp:GridView ID="dg_drawings"
runat="server" AutoGenerateColumns="False" EnableViewState="False" CellPadding="5" CellSpacing="0" Width="90%"
>
<Columns>
<asp:BoundField DataField="Description"
SortExpression="Description" />
<asp:BoundField DataField="sub_description"
SortExpression="sub_description" />
<asp:BoundField DataField="drawing_id" InsertVisible="False"
ReadOnly="True"
SortExpression="drawing_id" />
<asp:BoundField DataField="DRAWING_DESCRIPTION"
SortExpression="DRAWING_DESCRIPTION" />
<asp:BoundField DataField="DWG_URL" SortExpression="DWG_URL" />
</Columns>
</asp:GridView>
</td>
</tr>
</table>

Here is my C# code

public partial class listDrawings : System.Web.UI.Page
{
admin _admin = new admin();
private GridViewHelper helper;
int categoryid = 0;
protected void Page_Load(object sender, EventArgs e)
{
if (Convert.ToString(Session["logged_in"]) == "1")
{
ph_header.Controls.Add(LoadControl("../controls/builder_header.ascx"));
}
else
{
ph_header.Controls.Add(LoadControl("../controls/header.ascx"));
}
/*if (Convert.ToString(Session["details_hit"]) != "1")
{
_admin.add_page_hit("Standard Details");
Session.Add("details_hit", "1");
}
*/
string categoryidStr = Request.QueryString["categoryid"];
string category = Request.QueryString["category"];
//int categoryid = 0;
if (categoryidStr != null)
{
categoryid = Convert.ToInt32(categoryidStr);
}
category_name.Visible = true;
category_name.Text = category + " Drawing Details";
get_category_drawings(categoryid);
}
protected void get_category_drawings(int categoryid)
{
OracleConnection myConn;
OracleCommand myCmd;
if (categoryid == 3)
{
myConn = new OracleConnection(ConfigurationManager.AppSettings.Get("oracle"));
myCmd = new OracleCommand("DRAWINGS.GET_STAR_SUB_DRAWINGS");
myCmd.CommandType = CommandType.StoredProcedure;
myCmd.Connection = myConn;
myCmd.Parameters.Add(new OracleParameter("iCATEGORY", OracleDbType.Int32, ParameterDirection.Input)).Value = categoryid;
myCmd.Parameters.Add(new OracleParameter("iSUB_CATEGORY", OracleDbType.Int32, ParameterDirection.Input)).Value = 0;
myCmd.Parameters.Add(new OracleParameter("oDRAWINGS", OracleDbType.RefCursor, ParameterDirection.Output));
}
else
{
myConn = new OracleConnection(ConfigurationManager.AppSettings.Get("oracle"));
myCmd = new OracleCommand("DRAWINGS.GET_STAR_DRAWINGS");
myCmd.CommandType = CommandType.StoredProcedure;
myCmd.Connection = myConn;
myCmd.Parameters.Add(new OracleParameter("iCATEGORY", OracleDbType.Int32, ParameterDirection.Input)).Value = categoryid;
myCmd.Parameters.Add(new OracleParameter("oDRAWINGS", OracleDbType.RefCursor, ParameterDirection.Output));
}
try
{
myConn.Open();
this.dg_drawings.DataSource = myCmd.ExecuteReader();
dg_drawings.DataBind();
helper = new GridViewHelper(this.dg_drawings);
string[] cols = new string[2];
cols[0] = "Description";
cols[1] = "sub_description";
helper.RegisterGroup(cols, true, true);
helper.ApplyGroupSort();
}
catch (OracleException ex)
{
if (categoryid == 3)
{
_admin.send_email("resources/listDrawings.aspx", "DRAWINGS.GET_STAR_SUB_DRAWINGS", ex.Message);
}
else
_admin.send_email("resources/listDrawings.aspx", "DRAWINGS.GET_STAR_DRAWINGS", ex.Message);
Response.Redirect("~/error.aspx");
}
finally
{
myCmd.Dispose();
myConn.Close();
myConn.Dispose();
}
}
}

View 5 Replies

Forms Data Controls :: How To Stop ObjectDataSource Query When GridView DataKey Is Missing

Mar 3, 2010

I have a Gridview which is populated from an ObjectDataSource. Data Source has a control parameter hooked up to the SelectedDataKey value of the GridView. My Gridview has rows which may not have a DataKey. I am receiving an error when a GridView row without a DataKey is selected.

View 5 Replies

Web Forms :: Get Values From Helper Classes?

Jun 1, 2010

I am learning how to work with BLL and DAL

I have 2 class files in BLL and using DAL i am connecting to the sql database

in BLL i have a class called productsHelper.cs and using GetProducts() method used to fetch records from database

products.cs - have all insert,edit,delete methods

I want to bind all products to gridview

But I couldnt find how to do that.how to get those methods to my aspx.cs page from class files.and write code in there.

View 5 Replies

Forms Data Controls :: Gridview Item Template Checkbox Form Label Is Missing?

Mar 17, 2011

I am using gridview. I Added checkboc under itemtemplate.My page works fine. i have set my page according 508 standards. It looks for associated control id for every textbox, check box..etc.

When i check my page by 508 standards its giving form lable is missing for gridview item tamplate checkbox. i tried adding lable inside item tamplate and i set the check box id as Associated control id for the label. eventhough its not going off that error. After setting some text my errors are resolved.

but if add any text item template checkbox alignment is missing. i cann't hidden the lable. If i hidden the label it again show up Form label is missing. how can i add lable without effecting to GV item template checkbox alignment.

View 1 Replies

Forms Data Controls :: Allow Only One Check Box To Be Checked In The GridView?

Nov 16, 2010

I have a gridview that returns several records for the same user and each record has a column with a check box. I need to allow the user to choose only one to check. Also one check box is always supposed to be checked. What is the best way to do it? I was thinking of writing a stored procedure that checks if only one is checked, and then returns true or false. I think there is a more efficient way to do it...

View 3 Replies

Forms Data Controls :: GridView And Check Box In One Of The Columns?

Jan 24, 2011

I have a GridView and check box in one of the columns.what i need to do is, if the checkbox is checked i need to replace it with a Tick Mark image instead of checkbox, otherwise leave the column blank.

View 13 Replies

Forms Data Controls :: Check If A GridView Exists?

Dec 9, 2010

I have a page with a simple textbox, when an OrderNo is entered in te textbox the page is populated with 2 or 3 gridviews depending if the order has items reserved or on back order.

GridView1 has data about the order, like status, payment details.

GridView2 has data about orderitems, each row displays an item from the order with stock and order quantities

GridView3 has data about backorders, each row displays an item from the order with quantity reserved and quantity on back order. As is no data for GridView3 if order is not on backorder I thought that I can enclose my code inside an if block

if GridView3 isnot nothing then

'getting some data from the cells in GridView3
endif

but the code still executes.

View 2 Replies

Forms Data Controls :: Gridview Check Box And Parse()?

Oct 5, 2010

Documentation for using a checkbox with a gridview has the following statement:Because a check box can display only a selected or an unselected state, a CheckBoxField object can be bound only to a field with a Boolean data type or a string that can be parsed byParse.No example has yet been found to explain how using Parse to control the value of theis done. Interestingly enough I can find a fine example for the unlikely scenario of embedding a bulleted list in a grid cell.

View 4 Replies

Forms Data Controls :: String Data Missing Start From "+" When Export Data To Excel Using Gridview?

Aug 27, 2010

I am exporting data from gridview to excel file.My problem is that for all the string which contain "+", the rest of data begining from it is missing in excel file.For example: PWE-WER+78, when exported it will become PWE-WER.Below is my code.

[Code]....

View 3 Replies

Data Controls :: Check Uncheck All CheckBox In Child (Nested) GridView When Parent GridView CheckBox Is Checked Unchecked?

May 7, 2015

when i checked the checkbox in parent gridview, all checkbox in child gridview will be checked.

how can i select the checkbox of child gridview checkbox in the when i select the checkbox from the parent gridview?

code behind
protected void OnCheckedChanged(object sender, EventArgs e)
{

[Code].....

View 1 Replies

Forms Data Controls :: Best Place Check Box Inside Gridview?

Jun 7, 2010

I have a column of type bit, I want to display checkboxes on bases of values 1 and 0. So that in edit mode if i unchecked the box then the database should contain the value 0.

[Code]....

View 3 Replies

Forms Data Controls :: Check Which Linkbutton In Gridview Is Clicked?

Mar 10, 2011

i have a asp gridview contains linkbutton , i get the values in forloop , but how can i check which linkbutton i was click

View 5 Replies

Forms Data Controls :: RadioButton In GridView - How To Check/uncheck

Mar 17, 2011

I got a GridView and 2 columns have a radiobutton in each, named rbStatus.

1 coulmn header name Aired and other column named "Missed".

They are not databound.

How do I check the radio button in code behind?

Or should I make it databound?

The field to be displayed in the column "Aired" is boolean type.

If the "Aired" is not checked, I need to set the "Missed" checked.

[Code]....

View 4 Replies

Forms Data Controls :: Check Box Control Inside The Gridview

May 20, 2010

I wrote simple program in that i have one gridview in that i added one template field Checkbox controll.

this is my gridview1

<asp:GridView ID="GridView1" runat="server" Width="100%" AutoGenerateColumns="False" CellPadding="4" ForeColor="#333333" GridLines="None" OnSelectedIndexChanged="GridView1_SelectedIndexChanged" AllowPaging="True" OnPageIndexChanging="GridView1_PageIndexChanging"
PageSize="20">
<RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
<Columns>
<asp:TemplateField >
<ItemTemplate>
<asp:CheckBox runat="server" Text='<%# DataBinder.Eval( Container.DataItem, "Title") %>' ID="chk1" />
</ItemTemplate>
</asp:TemplateField>
<%-- <asp:BoundField DataField="Title" HeaderText="Title" />--%>
<asp:BoundField DataField="Creation_Date" HeaderText="Creation Date" />
</Columns>
<FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
<HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<EditRowStyle BackColor="#999999" />
<AlternatingRowStyle BackColor="White" ForeColor="#284775" />
</asp:GridView>

i have one button control in that click event i write some code like this

protected void btndelete_Click(object sender, EventArgs e)
{
CheckBox chk;
for (int i = 0; i < GridView1.Rows.Count; i++)
{
CheckBox cb = (CheckBox)GridView1.Rows[i].Cells[0].FindControl("chk1");
if (cb.Checked)
{
Response.Write("checked");
}
}
}

but when i run this code that check box return vlues every time false when i clicked the checkbox.

View 3 Replies

Forms Data Controls :: Disable Check Box In A Gridview Does Not Working?

Aug 22, 2010

I have a check box in a template field in a gridview.

Based on some condition, I want those check boxs to be enable and disable.

I am trying the below code but does working..

[Code]....

View 3 Replies

Forms Data Controls :: Retrieving Datakey, (an ID Value) From GridView Via Check Box?

Apr 13, 2010

I have a GridView with a checkbox for the user to select different categories. I am trying to retrieve the CategoryID associated with each row when the user clicks next, however I keep getting an error that tells me the selected index cannot be negative or out of range.

Here is my function

[Code]....

How do I retrieve the CategoryID of the row as an Integer value?

View 7 Replies

Forms Data Controls :: Make Check Box Update In Gridview

Jan 18, 2010

I have column in the database it's type is bit ,so I bind it to checkbox the problem is I want to make this checkbox update this column in the database I tried to insert command field in the gridview(update one) and convert it to tepelete and delete the button and insert checkbox insted but it not fire the gridview_rowUPdating function so how can I do it.

View 5 Replies

Forms Data Controls :: GridView / Make A Check Box Infront Of Each Row?

Jan 11, 2011

i have agridView that i fill its contents in thr runtime and i need to make a check box infront of each row.

i tried to make acheckbox field but it didn't appear in the grid.

View 6 Replies

Forms Data Controls :: Check If A User Already Exist In A Gridview?

Feb 5, 2010

I have detailed view and a grid view, the DetailedView does the inserting into the Grid view. On my table( Ussing SQL Server), i have a username and year and allocation. What do i do so that when an allocation is given to a user for a year that already exit, it refuses.

View 9 Replies

Forms Data Controls :: Replace 'select' In Gridview With Check Box?

Jun 14, 2010

I have this scenario where i want to select multiple customers at a time and add them to a group/role. to do this i thought of using a gridView and listed them all with sqlDatasource and enabled 'selection' for gridview. but by default grid view is allowing only one selection at a time. so is there a way i can insert a new column of check boxes and some how read the gridview to know which checkboxes are selected? if you know a better approach than a gridview or check box please suggest me. i am not very familiar with asp.net so

View 3 Replies

Forms Data Controls :: Top Gridview Row Checkbox Doesnt Check?

May 12, 2010

Im using the following code to get the gridview rows that are checked and then add the values to the database.Its all works correctly unless apart from when i check the row at the top of the gridview where when i check the checkbox it doesnt even change to checked so i cannot add that row into the database.

[Code]....

View 5 Replies

Forms Data Controls :: Allow User To Check Only One Row At A Time In Gridview

Mar 23, 2011

i want to allow user to select only one row at a time in gridview by selecting a chechkbox.

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved