REPLACE ( string_expression , string_pattern , string_replacement )
Hi All In this blog you will get to know some of the problems i have faced during my day to day work. and the solutiosn that i have used for those problems.
Wednesday, December 14, 2011
Replace in sql
Monday, December 5, 2011
Charindex in sql
SET @FullName = 'www.java2s.com'
SET @SpaceIndex = CHARINDEX('java', @FullName)
SELECT LEFT(@FullName, @SpaceIndex - 1)
SET @SpaceIndex = CHARINDEX('java', @FullName)
SELECT LEFT(@FullName, @SpaceIndex - 1)
Friday, December 2, 2011
Radio button with gridview asp.net
Hi Ther,
We are facing many problems with including radio button with grid
one of them is all are selected because they are generating different name in html
to overcome we have to do the following then its easy.
in html code we have to assign its checked chang event and in code back we have to write the code like this
foreach (GridViewRow row in gridViewProducts.Rows)
{
((RadioButton)row.FindControl("radioButtonToSelectTheProductResult")).Checked = false;
}
var radioButton = (RadioButton)sender;
radioButton.Checked = true;
then what we are doing here is setting first all check box to false and then the one who is sender to true.
by default with radio we are giving customer to select one, we are not allowing to deselect all.
so one who is clicked is already selected in grid.
It is working correctly there.
Engjoy radiobutton with gridview
Thanks & Regards
Nipam Budhabhatti
We are facing many problems with including radio button with grid
one of them is all are selected because they are generating different name in html
to overcome we have to do the following then its easy.
in html code we have to assign its checked chang event and in code back we have to write the code like this
foreach (GridViewRow row in gridViewProducts.Rows)
{
((RadioButton)row.FindControl("radioButtonToSelectTheProductResult")).Checked = false;
}
var radioButton = (RadioButton)sender;
radioButton.Checked = true;
then what we are doing here is setting first all check box to false and then the one who is sender to true.
by default with radio we are giving customer to select one, we are not allowing to deselect all.
so one who is clicked is already selected in grid.
It is working correctly there.
Engjoy radiobutton with gridview
Thanks & Regards
Nipam Budhabhatti
Friday, November 18, 2011
Modal popup-;extender control with asp. net
Normal ajax popup extender control is using the client side calls.
so from backside if we want to starts the modal control from code
then first we have to give the faxe control for target control id
then from code we can show extender.Show(); method
then we can choosse the update panel to open it also at the time of update panel.
Thanks & Regards
Nipam Budhabhatti
so from backside if we want to starts the modal control from code
then first we have to give the faxe control for target control id
then from code we can show extender.Show(); method
then we can choosse the update panel to open it also at the time of update panel.
Thanks & Regards
Nipam Budhabhatti
Friday, August 5, 2011
Javascript with Scriptmanager
ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "xxx", "alert('Hello World!');", true);
Wednesday, August 3, 2011
Change the schema in sql server 2008
alter
schema portal transfer dbo.table1
It has been long time
It has been a long time since i am active too
Monday, May 23, 2011
Inheritance
When we are calling the object of child class. always constructor of base class calls the first
In desctructor it is always first desctuct the child object than parent
A a2 = new B(); allowed
but we can not give reference of parent to child.
as int are structs and cannot have reference to object
int is using IEquatable interface to implement
which contains Equals method through which int can chek equality comparison there.
***************************************
namespace Test2 { public class A { public A() { Console.WriteLine("This class A"); } } public class B : A { public B() { Console.WriteLine("This class B"); } } public class C : B { public C() { Console.WriteLine("This class C"); } } }
namespace Test2 { class Program { static void Main(string[] args) { A a = new A(); System.Console.Read(); B b = new B(); System.Console.Read(); C cC1 = new C(); System.Console.Read(); } } }
File Upload Control in asp.net is not working with the update panel
Hi All
We are facing the problem of file upload control with the update panel
To solve this we need to do following thngs
We are facing the problem of file upload control with the update panel
To solve this we need to do following thngs
<form id="form1" runat="server"> <asp:FileUpload ID="FileUpload1" runat="server" /> <asp:UpdatePanel ID="Updatepanel1" runat="server"> <Triggers> <asp:PostBackTrigger ControlID="Button1" /> </Triggers> <ContentTemplate> <p> <asp:Button ID="Button1" runat="server" Text="Upload" OnClick="Button1_Click" /></p> <p> <asp:Label ID="Label1" runat="server"></asp:Label></p> </ContentTemplate> </asp:UpdatePanel> </form>
It is working with below texts
Page.Form.Attributes.Add("enctype", "multipart/form-data");
asynch file upload
<ajaxToolkit:AsyncFileUpload OnClientUploadError="uploadError" OnClientUploadComplete="uploadComplete" runat="server" ID="AsyncFileUpload1" Width="400px" UploaderStyle="Modern" UploadingBackColor="#CCFFFF" />
Wednesday, April 20, 2011
Forcefully download the pdf files
Response.ContentType = "application/pdf"; Response.AppendHeader("Content-Disposition", "attachment; filename=axz.pdf"); string path = "xyz.pdf"; byte[] buffer = System.IO.File.ReadAllBytes(path); Response.OutputStream.Write(buffer, 0, buffer.Length); Response.Flush();
Monday, April 11, 2011
Count with xpath
Labels:
Baroda,
Count with xpath,
Join,
Kutch,
Nipam,
Nipam Budhabhatti,
Pune,
XPATH
Tuesday, March 29, 2011
Left outer join in Linq C#
Left join Linq
from a in aa join a in xx on a.d equals x.y into DefaultOrEmptyXDetails from a in DefaultOrEmptyXDetails.DefaultIfEmpty() select new a)
Labels:
Join,
Linq,
Nipam,
Nipam Budhabhatti,
Pune,
Software Developer
Wednesday, March 23, 2011
Updating multiple rows from trigger byy inserted table
Hi All
Many times we are facing that we need to change the value of Column1 of Table2 when Table1 updates.
This below is given solution by- Nipam Budhabhatti
So we need trigger.
We can either select value in some variable.
but it has problem that we cannt update all rows.
so this is the solution
by implementing it we are sure that all records in Table2 are updated after updating table1.
CREATE TRIGGER [TrgName] ON Table1
FOR UPDATE
AS
UPDATE Table2
SET
Column1 = INSERTED.Column2
FROM INSERTED
WHERE
Column3 = Column4
Nipam Budhabhatti
Many times we are facing that we need to change the value of Column1 of Table2 when Table1 updates.
This below is given solution by- Nipam Budhabhatti
So we need trigger.
We can either select value in some variable.
but it has problem that we cannt update all rows.
so this is the solution
by implementing it we are sure that all records in Table2 are updated after updating table1.
CREATE TRIGGER [TrgName] ON Table1
FOR UPDATE
AS
UPDATE Table2
SET
Column1 = INSERTED.Column2
FROM INSERTED
WHERE
Column3 = Column4
Nipam Budhabhatti
Friday, March 11, 2011
textbox default button
javascript:
function clickButton(e, buttonid){
var evt = e ? e : window.event;
var bt = document.getElementById(buttonid);
if (bt){
if (evt.keyCode == 13){
bt.click();
return false;
}
}
}
TextBox1.Attributes.Add("onkeypress", "return clickButton(event,'" + Button1.ClientID + "')");
function clickButton(e, buttonid){
var evt = e ? e : window.event;
var bt = document.getElementById(buttonid);
if (bt){
if (evt.keyCode == 13){
bt.click();
return false;
}
}
}
TextBox1.Attributes.Add("onkeypress", "return clickButton(event,'" + Button1.ClientID + "')");
Thursday, March 10, 2011
go back javascript
protected void Page_Load(object sender, EventArgs e)
{
Button2.Attributes.Add("onClick", "javascript:history.back(); return false;");
}
{
Button2.Attributes.Add("onClick", "javascript:history.back(); return false;");
}
Explicit implement interfacess
Hi All
when we are explicitly implementing interface like..
if we have 2 interfaces which has same method; one class implements both,
then in derivced class we can not use public as access modifier to those implemented methods.
2 solve this i think we can create one wrapper method.
that method checks the type od object and according to type it will execute the method from those implemented.
I think this will help us to understand the working of interface little more.
when we are explicitly implementing interface like..
if we have 2 interfaces which has same method; one class implements both,
then in derivced class we can not use public as access modifier to those implemented methods.
2 solve this i think we can create one wrapper method.
that method checks the type od object and according to type it will execute the method from those implemented.
I think this will help us to understand the working of interface little more.
Wednesday, March 2, 2011
some nice site
there are sites
through wich we can get sign in different font
one of such site is
http://www.mylivesignature.com/
i have used
through wich we can get sign in different font
one of such site is
http://www.mylivesignature.com/
i have used
Tuesday, March 1, 2011
Webbrowser component c#
Some times webbrrowser component of c# not working fine
its not clearing cache
so we have to do some extra logic for run that
we can find the detail code here
and we are thankful to programmer who has suggested this Answer.
Click here for the Answer.
its not clearing cache
so we have to do some extra logic for run that
we can find the detail code here
and we are thankful to programmer who has suggested this Answer.
Click here for the Answer.
Monday, January 10, 2011
Wednesday, January 5, 2011
To Get Except
select * from V_EMailDefaults except
(select distinct V_EMailDefaults.* from V_EMailDefaults
inner join #tempEntities on V_EMailDefaults.EmailType collate SQL_Latin1_General_CP1_CI_AS = #tempEntities.EmailType collate SQL_Latin1_General_CP1_CI_AS
and V_EMailDefaults.Language collate SQL_Latin1_General_CP1_CI_AS= #tempEntities.Language collate SQL_Latin1_General_CP1_CI_AS)) a
WHERE (Entity = 'default')
and EntityType = #ENTITYTYPE#
^ and EmailType = #EMAILTYPE# ^
(select distinct V_EMailDefaults.* from V_EMailDefaults
inner join #tempEntities on V_EMailDefaults.EmailType collate SQL_Latin1_General_CP1_CI_AS = #tempEntities.EmailType collate SQL_Latin1_General_CP1_CI_AS
and V_EMailDefaults.Language collate SQL_Latin1_General_CP1_CI_AS= #tempEntities.Language collate SQL_Latin1_General_CP1_CI_AS)) a
WHERE (Entity = 'default')
and EntityType = #ENTITYTYPE#
^ and EmailType = #EMAILTYPE# ^
resolve collation
inner join #tempEntities on V_EMailDefaults.EmailType collate SQL_Latin1_General_CP1_CI_AS = #tempEntities.EmailType collate SQL_Latin1_General_CP1_CI_AS
Tuesday, January 4, 2011
Configuration for trace
Manual configuration:
Only enable "Events: RPC Completed"
then goto "Column fitlers"
Select "TextData" on the left site.
Click on 'like' and paste:
%@p_SYS_USERID=N'bastw'%
Click on 'not like' and paste (4 entries):
exec sp_executesql N'update std_queries%
exec sp_executesql N'--Get queryName%
exec sp_executesql N'SELECT * FROM Std_Users WHERE userID=@Userid AND password=@Password%
exec sp_executesql N'UPDATE Std_Users SET stamp%
Only enable "Events: RPC Completed"
then goto "Column fitlers"
Select "TextData" on the left site.
Click on 'like' and paste:
%@p_SYS_USERID=N'bastw'%
Click on 'not like' and paste (4 entries):
exec sp_executesql N'update std_queries%
exec sp_executesql N'--Get queryName%
exec sp_executesql N'SELECT * FROM Std_Users WHERE userID=@Userid AND password=@Password%
exec sp_executesql N'UPDATE Std_Users SET stamp%
Subscribe to:
Posts (Atom)