|
I assume that you set the button visibility from the code behind on some sort of condition, so when you set the visibility for the button, change the default button for the panel as well.
if(someCondition)
{
mainButton.Visible = false;
pnlDetails.DefaultButton = "secondButton";
...
...
}
else
{
mainButton.Visible = true;
pnlDetails.DefaultButton = "mainButton";
...
...
}
Hope this helps
No matter how long he who laughs last laughs, he who laughs first has a head start!
|
|
|
|
|
Thanks Jacques,
Great, great, great! It was so simple.
Merci beaucoup!!!
|
|
|
|
|
it's my pleasure, glad I could help
No matter how long he who laughs last laughs, he who laughs first has a head start!
|
|
|
|
|
The panel control has the viewstate property and div doesnt A Panel control requires more processing to generate HTML, while a requires less.
|
|
|
|
|
what is the use for panel. i need an explanation for panel... in asp.net
|
|
|
|
|
Here you go
MSDN[^]
No matter how long he who laughs last laughs, he who laughs first has a head start!
|
|
|
|
|
You have to wrap the controls in a panel object, and assign a default button to the panel. Took me years to figure that out.
|
|
|
|
|
I am adding a checkboxlist control to a new asp.net 2010 web form page. I want a header to showup on the control. For this to occur, I am thinking of having the first now in the column to be the header row. The checkboxlist control will be loaded with data from the database with code. However to load this first row with 'header' datq, i am wondering how you suggest I code it? Initially would I load the checkbox list control to look like the following before the control is loaded with data dynamically:
[^]<asp:CheckBoxList ID="CheckBoxList1" runat="server">
<asp:ListItem>cCompany Name</asp:ListItem>
</asp:CheckBoxList>[^]
If not, what would you suggest I try?
Also, can you tell me any other way you suggest I add a header row to the checkbox list control?
|
|
|
|
|
Just put a label on top of it, which is just span tags
|
|
|
|
|
I will give details of the infrastructure I have built and will talk about the problem in the end.
Database table "dbo.SmartPhoneBase" details: Following are the columns in the table.
SmartPhoneBaseID (Identity Primary Key)
Company
PhoneName
RAM
Storage
Database table "dbo.SamsungPhone" details: Following are the columns in the table.
SamsungPhoneID (Identity Primary Kay)
SmartPhoneBaseID (Foreign Key to dbo.SmartPhoneBase)
AndroidVersion
QualcommProcessorTech
AMOLEDDisplayTech
Entity classes for the above tables:
public class SmartPhoneBase
{
public virtual int SmartPhoneBaseID { get; private set; }
public virtual string Company { get; set; }
public virtual string PhoneName { get; set; }
public virtual string RAM { get; set; }
public virtual string Storage { get; set; }
}
public class SamsungPhone:SmartPhoneBase
{
public virtual string AndroidVersion { get; set; }
public virtual string QualcommProcessorTech { get; set; }
public virtual string AMOLEDDisplayTech { get; set; }
}
Mapping class for the above entity classes:
public class SmartPhoneBaseMap:ClassMap<SmartPhoneBase>
{
public SmartPhoneBaseMap()
{
Schema("dbo");
Table("SmartPhoneBase");
Id(x => x.SmartPhoneBaseID)
.Column("SmartPhoneBaseID")
.GeneratedBy.Identity();
Map(x => x.Company).Length(100).Not.Nullable();
Map(x => x.PhoneName).Length(100).Not.Nullable();
Map(x => x.RAM).Length(100).Not.Nullable();
Map(x => x.Storage).Length(100).Not.Nullable();
}
}
public class SamsungPhoneMap:SubclassMap<SamsungPhone>
{
public SamsungPhoneMap()
{
Schema("dbo");
Table("SamsungPhone");
Map(x => x.AndroidVersion).Length(100).Not.Nullable();
Map(x => x.QualcommProcessorTech).Length(100).Not.Nullable();
Map(x => x.AMOLEDDisplayTech).Length(100).Not.Nullable();
}
}
Please note following points.
1. For the subclass "SamsungPhone" the primary key is not allowed to be mapped with the method Id() hence I did not keep the property for same reason in the subclass even though its corresponding table "dbo.SamsungPhone" has a primary key. I created it just for the sake of it.
2. The table "dbo.SamsungPhone" does refer to "dbo.SamrtPhoneBase". Initially I had created a One-To-One relation between their corresponding entities but I saw that the error still appeared as it is (error mentioned below). So for the sake of simplicity I removed the relation from mapping classes even thought it still exist in DB.
Now I wrote the following code in the page load of my sample web application.
var result = nhSession.QueryOver<SmartPhoneBase>().List();
And following is the exception that is thrown and is visible on the browser.
Invalid column name 'SmartPhoneBase_id'.
Invalid column name 'SmartPhoneBase_id'.
Yes it appeared twice.
I am not sure what is going wrong but what I am sure about is that my fluent configuration and my other mappings are all correct as they are all working fine, even the mapping for table-per-class-hierarchy is correct and they are all working fine.
I need some help here.
Thanks in advance!
|
|
|
|
|
Well guys I just got the answer to the above problem. I just missed this mapping in the class SamsungPhoneMap
KeyColumn("SmartPhoneBaseID");
I did not see this being mentioned anywhere, not even the Fluent Nhibernate talks about it. But all's well that ends well, I got the answer at last.
|
|
|
|
|
hello guys.. When I apply some styles to my master page, VS does not show those styles properly in the design mode. If I run the project then these styles are shown properly. How can I fix this issue? thnx
|
|
|
|
|
give up on the design mode view....
maybe not the answer you want to hear but I only use it for a very general and basic idea of how things will look. if I want to see the real result I run it through ie, chrome, safari and firefox.
maybe not the best answer but it's the best I can give based on my experience.
as if the facebook, twitter and message boards weren't enough - blogged
|
|
|
|
|
Yes you are right. But the thing is, when I see some video tutorials online and I see that they are working with no problem whatsoever, then I get worried. If they can work, why can not mine?
|
|
|
|
|
I have a 2010 C# asp.net webform application that I just placed a checkboxlist control on the form. The problem is the selections
that are user can make are extremely large. Thus i am wondering if there is away to make the checkbox list control have a scroll bar?
Can I embedded the checkboxlist control in some type of a web control? If so what would it be?
Should I just use a regular checkbox control and put a group control are the checkboxes? Would this help anything?
|
|
|
|
|
|
step by step how to upload sql server database on webserver
and in which extension
please reply asap
rizvan sivally
|
|
|
|
|
Please don't ask for urgent or asap response. This is a volunteer site and people will answer you on their own time, not yours.
There is a wealth of information available for this if you take the time search
No comment
|
|
|
|
|
If I have selected counrty from dropdown list ,then contry related states shoould be visible in next the dropdun list.
Poonam Jagdale
|
|
|
|
|
|
hi,
im new at asp.net programming. In my menu there are 2 department, dept1 & dept2.Recently i have designed a website. Website's menu is designed by html and css.
Now i registered 2 user using asp.net web administration tool. User1 for dept1 and user2 for dept2. User1 can not access the page under dep2. Now the problem is when I click dept2 as user1, it shows me http404 error that the contents can not be found. Now what I want is if I click dept2 as user1 it will take me to the login page again. Again I made up that menu using css and html.
Any suggestion?
Thank You
|
|
|
|
|
I would suggest either setting the menu items visibility in the code behind depending on the roles (if the user does not have access why even display the menu item to them) or to load the menu items dynamically from the database by associating menu items to roles, and using the current users role to load the menu items and build your menu like that.
No matter how long he who laughs last laughs, he who laughs first has a head start!
|
|
|
|
|
I have a web page in which there is GridView binded with some records.
There are two buttons i.e. delete button and update button in the grid. Now When i click delete button, then the RowCommand event fires and it works perfectly. But when I click on update button to update the current row and then clicks on delete button to delete any row, then the following error occurs :
Invalid postback or callback argument. Event validation is enabled using <pages enableeventvalidation="true"> in configuration or <%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation
I have also used "EnableEventValidation='False'" in the page.aspx
but still getting same error ..
Kindly help ASAP
|
|
|
|
|
Since the sever generated the object, it expects to have full control over it. So the delete has to delete in the server side post back, and then rendered again on page load. It's a security issue in asp.net. You can wrap the object in an update panel, and so a small ajax trip to the server and back, while maintaining server side control.
|
|
|
|
|
I am adding a checkboxlist control to a C# asp.net 2010 since I am new to working with web pages. The following code works if I hardcode the value in the where clause. However, I want to pass the value in the where clause as a paramter. Thus can you tell me what I could change in the code below to pass the value to the where statement not as a hardcoded value?
[^]DBConnection.FillAttChkListBox(ChkBoxLstPlan, "Hnumber", "Hnumber",
DBConnection.ExecuteQuery("select p.Hnumber from dbo.Org o inner join Pl p on o.OrganizationID =p.OrganizationID where OrganizationName='orgname1'"), false);
public static DataTable ExecuteQuery(string SQLstring)
{
string constr = ConfigurationManager.ConnectionStrings["DBConnectionString"].ConnectionString;
//string constr = ConfigurationManager.ConnectionStrings["Client_ServiceConnectionString"].ConnectionString;
SqlConnection conn = new SqlConnection(constr);
DataTable dt = new DataTable("tbl");
using (conn)
{
conn.Open();
SqlCommand comm = new SqlCommand(SQLstring, conn);
comm.CommandTimeout = 0;
SqlDataAdapter da = new SqlDataAdapter(comm);
da.Fill(dt);
}
return dt;
}
public static void FillAttChkListBox(CheckBoxList chklistBox, String dataValueField, string dataTextField, DataTable dataTbl, bool bHasBlank)
{
chklistBox.DataTextField = dataTextField;
chklistBox.DataValueField = dataValueField;
chklistBox.DataSource = dataTbl;
chklistBox.DataBind();
if (bHasBlank)
{
chklistBox.Items.Insert(0, new ListItem());
// chklistBox.Items.Insert(1, new ListItem("All"));
}
}[^]
|
|
|
|