Filed under: Uncategorized
किसने दस्तक दी ये दिल पर कौन है,
आप तो दिल में है तो बाहर कौन है |
राज जो कुछ हो दिल में इशारो में बता भी देना,
हाथ जब उससे मिलाना तो दबा भी देना |
कभी दिमाग कभी दिल कभी नजर में रहो,
ये सब तुम्हारे ही घर है किसी भी घर में रहो |
जुबा तो खोल नजर तो मिला जवाब तो दे
मैं कितनी बार लुटा हु मुझे हिसाब दो दे |
तेरे बदन की लिखावट में है उतार चड़ाव,
मैंने कैसे पडूंगा मुझे किताब तो दे |
रोज तारो को नुमाइश में खलल पड़ता है,
चाँद अँधेरे में निकल पड़ता है |
उसकी याद आई है ऐ सासों जरा धीरे चलो,
की धड़कन से भी इबादत में खलल आता है |
Hello Friends,
Hope you are doing great!
Today I will show you how create Accordion Panes at run time.
As you might know, The Accordion is a web control that allows you to provide multiple panes and display them one at a time. It is like having several CollapsiblePanels where only one can be expanded at a time.
The Accordion is implemented as a web control that contains AccordionPane web controls. Each AccordionPane control has a template for its Header and its Content.
Here I will show you how to generate them at rum time and adding some control to them.
Lets first define our Accordion control:
Accordion ID="MyAccordion"
runat="server"
SelectedIndex="0"
FadeTransitions="false"
FramesPerSecond="40"
TransitionDuration="250"
AutoSize="None"
RequireOpenedPane="false"
HeaderCssClass="accordionHeader"
HeaderSelectedCssClass="accordionHeaderSelected"
ContentCssClass="accordionContent"
Now read the Pane Titles from Db into a table.
Dim dtDataTable As CollectionDS.CollectionDataTable = clsDb.pub_CollectionRead.Collection
Above statement will return a list collections which will serve as Pane Titles.
now first clear our Pane collection and then create pane one by one.
MyAccordion.Panes.Clear()
Dim intCount As Integer = 1
For Each drRow As CollectionDS.CollectionRow In dtDataTable.Rows
'Create a new Pane
Dim test As AjaxControlToolkit.AccordionPane = New AjaxControlToolkit.AccordionPane()
test.ID = "test_" & drRow.lngId.ToString
'Add A header
Dim lblhead As New Label
lblhead.ID = "lblHead_" & drRow.lngId.ToString
lblhead.Text = intCount.ToString & ". " & drRow.strCollectionName
lblhead.CssClass = "accordionLink"
lblhead.ForeColor = Drawing.Color.White
test.HeaderContainer.Controls.Add(lblhead)
'You can add any control here, i am using a grid
Dim gvGrid As New GridView
gvGrid.ID = "gvGridView_" & drRow.lngId.ToString
gvGrid.AutoGenerateColumns = False
gvGrid.CssClass = "GridStyle"
gvGrid.RowStyle.CssClass = "GridItemStyle"
gvGrid.AlternatingRowStyle.CssClass = "GridAlternatingItemStyle"
gvGrid.HeaderStyle.CssClass = "GridHeaderStyle"
Dim colId As New BoundField
colId.DataField = "lngId"
colId.HeaderText = "ID"
gvGrid.Columns.Add(colId)
Dim coltext As New BoundField
coltext.DataField = "strName"
coltext.HeaderText = "Name"
gvGrid.Columns.Add(coltext)
Dim colDesc As New BoundField
colDesc.DataField = "strDescription"
colDesc.HeaderText = "Description"
gvGrid.Columns.Add(colDesc)
test.ContentContainer.Controls.Add(gvGrid)
'I can also define handler for row bound if i want.
AddHandler gvGrid.RowDataBound, AddressOf gvGrid_RowDataBound
gvGrid.DataSource = clsDb.pub_CollectionItemRead(drRow.lngId).CollectionItems
gvGrid.DataBind()
gvGrid.Columns(0).Visible = False
Me.MyAccordion.Panes.Add(test)
intCount = intCount + 1
Next
Thats it, too simple, so by this way I can create my accordion panes on fly and also assign them the controls.
I hope this article is useful to you and you like it.
Happy Programming
Ashish Kumar Mahajan.
Hello Friends,
Hope you are doing great!
Today I will show you how to find any text in stored procedures. We need to do it so many times and you might be doing manual work to find it.
You may also use sp_depends “tableName”, but it may not return accurate results.
So here are some other ways:
SELECT *
FROM syscomments sc
INNER JOIN sysobjects so ON sc.id=so.id
WHERE sc.TEXT LIKE ‘%lnkSpedPagesDataToStudent%’
——————————————————
SELECT *
FROM sys.procedures
WHERE OBJECT_DEFINITION(OBJECT_ID) LIKE ‘%lnkSpedPagesDataToStudent%’
….
Hope, it works for you!
Thanks,
Ashish
Dear Friends,
In this post, I will show you how to find if a column already exists in a temporary table and if not add that column in temporary table.
First create our temporary table and also add some columns in it.
IF OBJECT_ID(‘tempdb..#tempTable’) IS NOT NULL
DROP TABLE #tempTable
CREATE TABLE #tempTable
(
FieldName VARCHAR(50),
FieldDescription VARCHAR(100),
FieldData VARCHAR(5000)
)
Now suppose you have a table tblMenus with a column strMenuName and you want to add one column in #tempTable for each row in tblMenus. Here is the way to do it:
DECLARE @strMenu AS VARCHAR(30)
DECLARE @sql AS VARCHAR(1000)
DECLARE cur_Menus CURSOR
FOR SELECT strMenuName
FROM dbo.tblMenus
OPEN cur_Menus
FETCH NEXT FROM cur_Menus INTO @strMenu
WHILE @@FETCH_STATUS = 0
BEGIN
SELECT @sql = ‘IF NOT EXISTS (SELECT ”X” FROM TEMPDB.SYS.COLUMNS WHERE [OBJECT_ID] = OBJECT_ID(”tempdb..#tempTable”) AND [NAME] = ”’ + @strMenu + ”’)
BEGIN
ALTER TABLE #tempTable ADD [' + @strMenu + '] VARCHAR(30)
END’
EXEC(@sql)
FETCH NEXT FROM cur_Menus INTO @strMenu
END
CLOSE cur_Menus
DEALLOCATE cur_Menus
You Now have all the row as column in temp table.
and of course never forget to free our temporary resources.
IF OBJECT_ID(‘tempdb..#tempTable’) IS NOT NULL
DROP TABLE #tempTable
Thanks,
Ashish
Dear Friends,
As working with GridView object in ASP.Net 3.5, i was facing a problem.
I have a gridview with some hidden column, here is my gridview structure:
<asp:boundfield visible=”False” datafield=”ID” />
<asp:boundfield datafield=”DOCNAME” headertext=”Name”>
<itemstyle horizontalalign=”Left”>
</asp:boundfield>
<asp:boundfield datafield=”VersionNumber” headertext=”Version”>
<itemstyle horizontalalign=”Center”>
</asp:boundfield>
<asp:boundfield visible=”False” datafield=”PDFFileName”>
<itemstyle horizontalalign=”Left”>
</asp:boundfield>
<asp:boundfield datafield=”intSequenceNumber” headertext=”Active”/>
<asp:checkboxfield datafield=”blnActive” headertext=”Active” />
As you can see I have Id and PDFFileName column hidden.
Now if i select some files and on postback i need those selected files and their Ids, i am getting blanks values for all the hidden cells.
This is how i was doing it:
Dim strIds As String = String.Empty
Dim strFiles As String = String.Empty
For Each drRow As GridViewRow In Me.gvHiddenColumn.Rows
strIds = strIds + drRow.Cells(pvt_GridColumn.ID).Text + “,”
strFiles = strFiles + drRow.Cells(pvt_GridColumn.PDFFileName).Text + “,”
Next
but i am getting ids and files balnks.
A simple solution for this problem is make the column hidden in the grid row bound event or after that, so i did it in prerender and it worked fine.
Private Sub GridViewHiddenColumn_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender
Me.gvColumns.Columns(pvt_GridColumn.ID).Visible = False
Me.gvColumns.Columns(pvt_GridColumn.PDFFileName).Visible = False
End Sub
Happy Programming,
Thanks,
Ashish