C# : Tutorial of Asp.net with c# and example

Example and code about windows application, web application, SQL, C#, WPF etc which is helpful to developer and programer.

Search This Blog

Asp.Net: How to make Button make as default button in asp.net?

♠ Posted by uvesh master in



How to make button as default button?

 
Your Button put in panel and give button id in DefaultButton property of panel. most of people think and find Button's property to make it default but actually here asp panel is require and set panel's property DefaultButtton="Here write button id which you want to make default"  .


<asp:Panel ID="pnl1" runat="server" DefaultButton ="Button1">
  <asp:Button ID="Button1" runat="server" text="Click Me!" />
   <asp:Button ID="Button2" runat="server" text="PushMe" />
</asp:Panel>


Here  your default button is  Button1
Using this functionality no need to click by button just enter and click event of default button is occures.

Here other property of button control is text which text you can see on button like as below image :



 

Improve Your Answer as comment below.
If our post is useful please share and comment on our post for more post and detail Visit :

http://aspdotnethelpmaster.blogspot.in/

 

SQL: 'IN' Query example in SQL with c#

♠ Posted by uvesh master in


Example of 'in Query' in SQL Server Management studio 2008 with C#

Whenever you fire where condition in SQL you need give some value in where condition some time you need to only assign only single value or some times you need to assign number of value in where condition that time IN Query is most useful. 

there may be in database comma sepreted  value in single field and you need to right in Where condition that time IN Query is most useful to you.

For Example In below code First make one string using foreach loop from datatable which is comma sepreted and ten last statement contain SQL Query which contain Where condition. 

here Where condition on empid field which compare number of empid at a time which is comma sepreted.


string var = "";
foreach (DataRow row in table.Rows)
{
var += row["emp_no"].ToString() + ",";
}
if (var.EndsWith(","))
{
var = var.Trim().Substring(0, var.Trim().Length - 1);
//do sql connection
string value1 = sql.GetSingleValue("select empuniqid from Empmaster where empid in ( " + var + " ) ");



Improve Your Answer as comment below.
If our post is useful please share and comment on our post for more post and detail Visit :

http://aspdotnethelpmaster.blogspot.in/