Accessing header on datagrid (template column)

How can i access the control a hyperlink on templatecolumn whic exists on header template?

 i tried this on datagrid's item created method but doesnt work

Dim lbl As HyperLink = DirectCast(dgI.FindControl("HyperLink7"), HyperLink)

lbl.Visible = False

 

how to access the header template and a hyperlink which exists there ?

0
bilencekic
12/24/2006 11:38:23 AM
asp.net.presentation-controls 72751 articles. 3 followers. Follow

10 Replies
759 Views

Similar Articles

[PageSpeed] 56

Use RowCreated event

try something like that were  templeteColIndex = index of you templete column

    protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.Header)
            e.Row.Cells[templeteColIndex].Visible = false;
    }

0
KirilRusev
12/24/2006 2:56:52 PM

no

i have a header on template column (in header template)
and a hyperlink near header (on same header template)

and i want to make hyperlink visible false.

it is not a gridview it is datagrid.

1
bilencekic
12/24/2006 3:08:12 PM
provide some code:) 
0
KirilRusev
12/24/2006 3:28:15 PM

<asp:TemplateColumn HeaderText="Kelime">

<ItemTemplate>

<%

#DataBinder.Eval(Container.DataItem, "Kelime")%>

</ItemTemplate>

<HeaderTemplate>

<a class="text_buyuk" href="#" onmouseout="return nd();" onmouseover="return overlib('<%=KelimeT%>',CAPTION,'Limit hakkinda', OPACITY, 100, FADEOUT);;"

style="font-size: 16px; color: darkorange"> Kelime</a>&nbsp;             <<<<<this is the original header

<asp:HyperLink ID="hyp_HELP" runat="server" Font-Bold="True"

ForeColor="Red" NavigateUrl="#" onclick="PopUp('SayfaKod-Yardim.aspx?sayfakod=1&yardimkod=01&baslik=hyp_HELP)"

onmouseout="return nd();" onmouseover="return overlib('...',CAPTION,'attention', OPACITY, 100, FADEOUT);;">Help</asp:HyperLink>

</HeaderTemplate>


 

</asp:TemplateColumn>

 

 

you see hyp_HELP

well , iwant it to control. If the user hastn got the necessary roles it will be visible=false  (i tried string like Visible='<%=Visible%>'  but gives error )
so hyp_HELP mustne be seen by everyone.
There is a header there named Kelime it will be visible but not the hyper link

0
bilencekic
12/24/2006 3:40:44 PM

Then you have ID of the  HyperLink => <asp:HyperLink ID="hyp_HELP"

this code should work fine:) 

Dim lbl As HyperLink = DirectCast(dgI.FindControl("hyp_HELP"), HyperLink)

lbl.Visible = False

0
KirilRusev
12/24/2006 4:19:06 PM

yeah but where ?

i tried that code.
itemcreated or else ? where on datagrid.


 

0
bilencekic
12/24/2006 4:23:10 PM

here your logic requires.

for example ->Page_Load 

0
KirilRusev
12/24/2006 5:07:29 PM

hi bilen,

you are using Gridview or DataGrid?

in case of datagrid use ItemDataBound event , in case of GridView use RowDataBound event.

do let me know .

thanks,

satish


Kind Attn: If a reply to your post helped you, kindly mark it as Answered.
__________________________________________________
Please save Animals Help World Society For Protection Of Animals,
Protect these speechless creatures of GOD
0
satish_nagdev
12/24/2006 5:10:56 PM

it is a datagrid

 

0
bilencekic
12/24/2006 5:17:13 PM
use ItemDataBound event
0
KirilRusev
12/24/2006 6:10:01 PM
Reply:

Similar Artilces:

How to access a template column in a datagrid control
I have a DataGrid control on a web form with a template column. How can I access the dropdownlist column "ddlusertype" from my c# code? I need to bind it with a DataTable. Please help, thanks! Here is my code <Columns> <asp:BoundColumn DataField="rolName" HeaderText="User Type"></asp:BoundColumn> <asp:BoundColumn DataField="rolDescription" HeaderText="Description"></asp:BoundColumn> <asp:BoundColumn DataField="gtyAbbr" HeaderText="Client Type"></asp:B...

how can i access a control in the edit template column of Datagrid
Hi I want to access or setfocus in a textbox control in the edit template column of a datagrid. i'm using the visual studio 2003 version. thanks for your responses..   Hi, You can browse through the following link. It might help you. http://www.syncfusion.com/FAQ/aspnet/WEB_c4c.aspx ThanksSharmila Use FindControl to get the reference of the textbox in the ItemDataBound event. TextBox tb  = (TextBox )e.Item.FindControl("TextBox1");   I'm sorry.. it doesn't worked.. i need to set focus  to a text box control used in the datagrid's edit template column.. wi...

How to access datagrid template column textbox text in vb.net?
I just want to access text from datagrid template column textbox,any one who knows solutions or suggestions(through codes), pls share it.Thanks in advance.  to access text from template column textbox... use FindControl() method... for Ex.,Label1.Text = ((TextBox)GridView1.Rows[0].Cell[0].FindControl("txtTextBox")).Text; //assuming that First Column; cells[0] is the TextBox Column... the code will retrieve text from first column textbox of the first row and assign to label...you can refer to this link also.. Control.FindControl Method (String) (System.Web.UI)  Edit...

How to access a CheckBox in the header row of a Template Column in a data-bound DataGrid
All-- Please help. How can one get a handle to a CheckBox that is in the header row of template column in a DataGrid that is data-bound? See below for details on what does NOT work. Any ideas? Please advise. Thank you. --Mark Here is the code in the ASPX file... <asp:datagrid id="MainDataGrid" runat="server"> <headerstyle horizontalalign="Left" verticalalign="Top" backcolor="LightBlue" font-bold="True" font-size="x-small"></headerstyle> <itemstyle horizontalal...

Access controls in Wizard control header template.
Is this possible?Web dev - spending forever achieving nothing. hi, suppose the control in the header template is a DDL with Id DropDownList1 access it this way DropDownList dp = (DropDownList)Wizard1.FindControl("headerContainer$DropDownList1");        Response.Write(dp.SelectedValue); hope it helpsJessica CaoSincerely,Microsoft Online Community Support“Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community ...

Solution Title: Datagrid Template Column Radio Button (get access to the rb control)
Hi. I have a radio button in a template column of a datagrid. All I need to know is how to get access to this to be able to set the radio button as checked or unchecked (depending on the results of a query). I'm trying this: Dim rbactionneeded As RadioButton = CType(e.Item.FindControl("rbactionneeded"), RadioButton) If ansval = "Y" Then 'result from stored procedure rbactionneeded.Checked = True End if (very simplified). I'm getting an erro...

Datagrid Edit, Cancel, Paging calls SortCommand...not just limited to column headers for template columns
My issue is I'm trying to have a datagrid (ASP.NET 1.1) to allow editing, along with sorting ASC/DESC via column headers. When I click "Edit", my SQL query ASC goes to DESC, and vice versa.  This happens on Cancel, Paging, Delete, etc...I'm trying to limit the "swap" in the order by criterion only when a header (of Template columns) is clicked.  ****************I have this in the HTML: OnSortCommand="SortDG" AllowSorting="True" ***************Code behind to try to limit only to column headers, but not working:P...

Datagrid Control, template columns
Hi all i am working on datagrid control. I have to columns both are template columns.The first template column contains a textbox control, the second column contains a dropdownlist. I need to bind the data to the first column fileupload control and the dropdownlist should be populated from the database. How do i go about doing this please help me.  Hi...If u want to Bind Text Box From Data Base then Bind TextBox Template as like below                          &l...

Accessing controls in datagrid header
I am trying to access controls is a header temple of a datagrid but cannot seem to figure it out. The examples I have found do not seem to work. The examples I have been trying to use follow the same format as below.  DataGrid1.Controls[0].Controls[0].FindControl("TextBox1") If I try to access any properties I get an error saying "Object reference not set to an instance of an object" Example  Dim TB as TextBox TB = DataGrid1.Controls[0].Controls[0].FindControl("TextBox1") response.write(TB.Text) Since you are using VB then use parents ins...

Control-Access in Template-Column ?
Hi! I createted a Template-Column in a DataGrid with a Dropdownlis set as edititem-control and bound it to values of a table on a MS-SQL-Server. So far so good - calling the edit command on runtime is working properly. The Items are correct i can select one and it will be written down to the database *but * I want to initialize the dropdownlist when calling th edit-command - the selecteditem should be a default-value. How can I achieve this. The Control is only exiting @ runtime ... Tryed to do sthg. like this: -- Private Sub DataGrid1_EditCommand(ByVal source...

Datagrid with column header templates
Hi all. this is my first time on these forums so please be nice... Im building a DataGrid where i display the contents from a database and have set up the column headers to sort each column. However I want to use the headertemplate to customise the layout of each column header but when doing so I loose the functionality to sort. Also another question is I have a label within this column template header but i cant seem to reference to it to change its properties. Does anybody have any tips on these things for me? I have searched high and low for possible answers both here and on google b...

Access Control In DataGrid Header
Consider the following DataGrid: <asp:DataGrid ID="dgMarks" AutoGenerateColumns="false" runat="server"><Columns><asp:TemplateColumn><HeaderTemplate><asp:CheckBox ID="chkHeader" OnCheckedChanged="CheckUncheckAllRows" AutoPostBack="true" runat="server"/></HeaderTemplate><ItemTemplate><asp:CheckBox ID="chkItem" OnCheckedChanged="CheckChanged" AutoPostBack="true" runat="server"/></ItemTemplate></asp:TemplateColumn></Column...

Serverside Template Control
I've created a template control what I am running into difficults is during the Page_Load event on my web page I cannot access the child controls in the two possible templates. What I would like to be able to do is set the value or make some changes to the control at runtime but I have not been successful in gaining code access to the control, for example the TEXTBOX1 control in the EditTemplate template.     Does anyone know a good way to preform this task, let alone if I am even using the correct event Example of HTML Render  <aspSample:TextLabe...

Accessing controls in template column with JavaScript
Hello List, Is it possible to access Button control within a template column in a datagrid with JavaScript? Thanks in advance! Peter...

Web resources about - Accessing header on datagrid (template column) - asp.net.presentation-controls

Highest Percentage Of Opera Mini Users Accessing Facebook? Macau
If you were asked to guess which country had the highest percentage of users of Opera mobile Web browser Opera Mini users accessing Facebook ...

International Users Accessing Facebook Places Through US VPN Accounts
By using a virtual private network (VPN) hosted in the United States, Facebook users from around the world are accessing Facebook Places. The ...

What are some alternatives to Yodlee for accessing bank information?
Clay Loveless , Founder, Jexy. Co-founder, Mashery. Founder, Jexy. Co-founder, Mashery.

Cloud Console - Accessing files in cloud storage for iPad on the iTunes App Store
Get Cloud Console - Accessing files in cloud storage on the App Store. See screenshots and ratings, and read customer reviews.

Meryl Streep On Accessing The Characters Within - YouTube
Meryl Streep talks about the importance of an actors work representing their ability. CONNECT WITH AFI: http://facebook.com/AmericanFilmInstitute ...

Student pleads guilty to accessing records about Frances Abbott design scholarship
The Sydney student who leaked information about a fashion school scholarship controversially awarded to the daughter of the Prime Minister has ...

Accessing a headline opinion
Accessing a headline opinion

Sharp increase in authorities accessing private data
Australian law enforcement and government agencies have sharply increased their access without warrant to vast quantities of private telephone ...

Former librarian charged with accessing student records of Frances Abbott
A former part-time librarian at a Sydney design school has been charged after she allegedly accessed student records of Prime Minister Tony Abbott's ...

Frances Abbott scholarship: Sydney woman pleads guilty to accessing Whitehouse Institute records on PM's ...
A Sydney woman who leaked the student records of Tony Abbott's daughter pleads guilty. A Sydney woman who leaked the student records of Prime ...

Resources last updated: 12/10/2015 10:30:09 AM