how to let ButtonColumn control button's visible's property in DataGrid


I has a ButtonColumn in a DataGrid,and a button in the page, In the page_load() event i wrote:

if (Not IsPostBack) then


end if

and the ButtonColumn CommandName="delete"

in the DataGrid1_delete() event i wrote


But when i press the "delete" ButtonColumn ,the button1 can not be visible,i don;t why

How can when i press "delete" ButtonColumn,the Button1 can be visible

Thanks a lot.




10/27/2007 3:21:08 PM 72751 articles. 3 followers. Follow

2 Replies

Similar Articles

[PageSpeed] 43

How can when i press "delete" ButtonColumn,the Button1 can be visible

When you press the Delete button in your datagrid, in should trigger an event called item_command.

Also, with your Delete button, you should set a command name for it. You can do this from the property builder, select columns, and then select your bound column to set the command name. 

In the event handler, you can then make your page button visible. 


private void DataGrid1_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
if (e.CommandName == "your buttons command name")
//show button
Button1.Visible = true;
10/27/2007 9:16:58 PM

Hi yugiant,

I have test your post above, and I wrote button1.visible=true in the event DeleteCommand and it works fine on my pc. DataGrid does not has an event named delete, try to use DeleteCommand please.

Samu Zhang
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 members reading the thread.
11/1/2007 10:44:35 AM

Similar Artilces:

Unable to access user control's user control's function\property from another user control
Hi, I used to call an user control's user control function as stated below from my user control in ASP.Net 1.1 wucCompany.wucEmployee.GetEmployeeSomething() After migrating to ASP.Net 2.0, I am unable to use any properties/functions(even the public ones) of the user control's User control's from another user control.  The way I have to do is create property\function in wucCompany which calls the wucEmployee's property\function and call the wucDepartment.GetEmployeeSomething().Since I need to do this change in too many places, I can...

Setting a panel control's visibility and it's affect in nested controls.
I am trying to debug a page using the panel control.  The code in the final submission of the form has logic to get data from a dropdown based on the control's visibility.  If the control's visibility is set to true, the the data is retrieved and sent to the database.The problem appears to be the dropdown control's visibility is set to false when it should not.  The dropdown is nested in a panel control.  While doing a trace, it appears when a panel control's visibility is set to false, the visibility for all controls nested under this panel are set to false as well.You'r...

Label control's text doesn't appear to be set (in the page which has a user control )when trying to update the text property in the FormView's ItemUpdated event
Hi There,I have a user control which hosts a formview control, gridview control and a label control. The grid view is usedto show rows in the DB and when clicked to edit each row, a form view opens up in edit mode with that particular row info. So I have nothing in the item template.My first question it mandatory to have smth in the itemtemplate of the form view.I have controls in edititemtemplate and insertitemtemplate.When a particular row is edited, I would like to show a status msg showing that the row has been updated.For this, I use the ItemUpdated event of the formview and try ...

Meke Control's property disabled or enabled based on another property's entered value ?
Does anyone know how to disable or enable a property in properties window based on value entered in another property?Please advise.Regards,Dimitry...

how to control a RadioButtonList's Listitem's text show according database's field
Hi my page has a repeater control,in repeater has a RadioButtonList control now i want to let the RadioButtonList has four Listitem,every Listitem's text is a database's field so the listitem can show dynamic according every record how can i work out my problem thanks a lot  hello dearbound your RadioButtonList to database if i m not clear fell free 4 replySatyabrat SinghB.E.(C.Sc.)Web developer Livetek Solution Dont forget to click "Mark as Answer" on the post that helped you. yes.i bound the radiobuttonlist to a dataset but how to display the ...

'Tab' control 's visible doesn't work.Why?
I use tab control in my applition. And I set visible=false, but it doesn't work. my code is: ----------------------------------------------- <asp:ScriptManager ID="ScriptManager1" runat="server" />  <div>   <ajaxToolkit:TabContainer runat="server" ID="Tabs" Height="138px" ActiveTabIndex="0"    Width="402px">    <ajaxToolkit:TabPanel runat="server" ID="Panel1" HeaderText="Tab1" Visible="f...

accessing a datawindow's control's properties using expresisons
Is it possible to access a column's y coordinate and use it in a datawindow extression? example: if(column.y > 500, a..., b...) If( Long( Describe( 'column.Y' )) > 500, a..., b... ) -- Paul Horan[TeamSybase] VCI Springfield, MA "Leon Mandel" <> wrote in message > Is it possible to access a column's y coordinate and use it in a > datawindow extression? > > example: > > if(column.y > 500, a..., b...) > ...

Is Datagrid's TemplateColumn's Inner Content limited for controls?
For some obscure reason, i can't use any type of non-builtin control inside a Datagrid's TemplateColumn.... tx 4 any info Could you give more information? Inside a templatecolumn you are able to put whatever markup you want, including server controls. Could you post part of your code and the problem you are seeing. are you sure you want me to bother you with my code?

Help! I cannot access the DataGrid's ItemTemplate's LinkButton's Text Atrribute 's Value!!!!!!!!!!!
I write a datagrid's ItemDataBound method as follows:   private void dgTable_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)  {   if(e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)   {    if(!isRole("Manager"))    {     LinkButton tmp = (LinkButton)e.Item.FindControl("lbPassed");     if(tmp.Text == "Passed")     {      ((LinkBu...

Can I hide a user control's control from the hosting page's client script?
Okay, my previous question was not unswered and I guess you can't hide a control's panel with server code then show it with client code. Now this is what I try to do: on the hosting page's onload event, call a function to hide the user control's penal. Here is the deal: the user control was looped as many times as data required. So the penals will be name mypanel1, my panel2, etc... that is not even a problem if I know if the following is true: * Do all server codes finish running before the page get sent back to the client? Say the database gave me 5 penals, I can then determine how...

How would I make a custom control's button's onclick event public?
I'd like to do something programatically in the parent class once a custom control's button is clicked.Anyone has a link to a tutorial?, EdMicrosoft MVP - ASP/ASP.NET thanks but I'm looking for a tutorial for since I'm not too sure how the intricacies of change or simplify that example, EdMicrosoft MVP - ASP/ASP.NET thanks a lotI feel mildly dumb now  ...

How to set a Master Page's control's property through content page on a postback event?
Hi all, i m using a master page in my application. i have a panel on master page and a tab container with three tab panels on content page. i want to set/change  the visibility of the panel control when the tab is changed on the content page. By default the panel is invisible. To implement this i executed the following steps: 1. Set AutoPostBack of tacontainer to true 2. Wrote an event handler for ActiveTabIndexChanged event of the tab container 3 Wrote the following code on Tab changed event   if (TabContainerEmpPerformance.ActiveTabIndex == 1) { ...

Control's (object's) default value??
How or where can I see an control's default value? Say, for example the Visible property for webcontrols? Would be preferable if I could quickly see it in Visual Web Developer but MSDN online documentation would also be nice. Also how can I do this in general for all .Net objects?...

Password Wizard 'Continue' Button
Can anyone tell me where i can find the 'image URL' property for the 'Continue' Button in the create password wizard - or if there is one or not. I've scoured the page(s) several times to no avail. If there isnt one then will someone please let me know, so I can abandon the search. Hi TheWacoKid Could you provide the standard name of a create password wizard control you mentioned? I guess it might be PasswordRecovery, CreateUserWizard, ChangePassword or some other control in VS 2005,Best RegardsXiaoYong DaiMicrosoft Online Community SupportPlease remember to click “Mark a...

Web resources about - how to let ButtonColumn control button's visible's property in DataGrid -

Resources last updated: 12/7/2015 6:46:19 PM