.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

I want to use the values executed by a dynamic sql in a view. Can this be possible? Can you please l

Posted By:      Posted Date: October 04, 2010    Points: 0   Category :Sql Server
Dynamic SQL Stored Proc:

        create procedure dbo.USP_USR_GETATTRIBUTEVALUE
                @AttributeName nvarchar(200),
                @ID uniqueidentifier,
                @AttributeValue nvarchar(200) output
                Declare @ATTRIBUTEVIEWNAME nvarchar(200)
                Declare @sql nvarchar(4000)

                set @ATTRIBUTEVIEWNAME = (select 'V_QUERY_ATTRIBUTE'+ convert(varchar(50),REPLACE(AC.ID,'-',')) from ATTRIBUTECATEGORY AC where AC.NAME=@AttributeName)


View Complete Post

More Related Resource Links

Disable filtering on a Dynamic Data list view.


I have an entity set of NotificationTemplates, and each one of these has a collection of zero-many SmsTemplate entities. When editing or viewing a NotificationTemplate, I have a link to View SMS Templates. That link takes me to a List view for the SmsTemplates entity set, filtered for the NotificationTemplate I was viewing.

How can I prevent the user changing this filter to show SmsTemplates for another NotificationTemplate? That is, I want the filter, but it must be read only. The drop-down just mustn't drop down, it must just display the name of the NotificationTemplate that these SmsTemplates belong to. To view SmsTemplates for another NotificationTemplate, the user must click View SMS Templates from that other template.

This was originally asked by myself on SatckOverflow at: http://stackoverflow.com/questions/3514373/disable-filtering-on-a-dynamic-data-list-view

create a dynamic view on code

How i can create a new view on code (on runtime) if this view dont exits?   Thanks

gridview help on each dynamic row solve this show values based on all columns

<asp:GridView style="Z-INDEX: 101; LEFT: 1px; POSITION: absolute; TOP: 183px" id="Gridview1" runat="server" Width="613px" Height="127px" ForeColor="Teal" Font-Size="12pt" Font-Names="Palatino Linotype" Font-Bold="True" Visible="False" BorderColor="Transparent" AutoGenerateColumns="false" CellSpacing="2" GridLines="None" OnRowCreated="Gridview1_RowCreated" SelectedIndex="5" ShowFooter="true" OnRowDataBound="Gridview1_RowDataBound"><Columns>  <asp:TemplateField HeaderText="ItemCode"><ItemTemplate> <asp:DropDownList id="DropDownList1" tabIndex=16 runat="server" AutoPostBack="True" DataValueField=" ItemCode " DataTextField=" ItemCode" ></asp:DropDownList></ItemTemplate></asp:TemplateField>  <asp:TemplateField HeaderText="ItemName"><ItemTemplate> <asp:DropDownList id="DropDownList2" tabIndex=16 runat="server" AutoPostBack="True" DataValueField="ItemName" DataTextField="ItemName" ></asp:DropDownList> </ItemTemplate> </asp:TemplateField>  <asp:TemplateField HeaderText="Category"&

Dynamic Dimension with Aggregate Values

Hi, I have an specific requirement to make the measure value as an dimension. Let me explain my problem in brief. I have a fact table with dimensions like Time, Products etc and having single fact table with two measures. I have to create a calculated measure which shows the average of Measure 1 (here used calculated measure because there are couple of other calculations involved). And other two calculated measures. when I drill down with Products dimension for Calculate measure 1, it shows the average value for each products. Now, I want this calculated measure values (includes Product dimesnion drill down) as a Dimension and based on this value, I need to show the value of other two measures. For example: when the dimension products is used for drill down the values displayed will be like this and in this I need CM1 to be another dimension Products CM1 CM2 CM3 P1 0.10% 20 1 P2 0.20% 40 2 P3 0.30% 80 3 P4 0.40% 70 4 P5 0.50% 30 5 P6 0.60% 110 6 P7 0.70% 120 7 P8 0.80% 130 8 P9 0.90% 86 9 P10 1.00% 65 10 when CM1 is used as a dimension it should show the value like this CM1 CM2 CM3 0.10% 20 1 0.20% 40 2 0.30% 80 3 0.40% 70 4 0.50% 30 5 0.60% 110 6 0.70% 120 7 0.80% 130 8 0.90% 86 9 1.00% 65 10 How can we create the dynamic dimension with the aggregated values? Any assistance will be greatly apprec

How to apply dynamic filter in Datasheet View from Query String

The datasheet view doesn't support either connections/dynamic filters from Query string. How to filter the data using query string?

How to filter a List View by multiple values for one filter field?

Hi, I need to create a dynamically created link to a List View with a filter on one field, but with multiple values. Example: http://<server>/Lists/<list>/Allitems.aspx?FilterField1=Name&FilterValue1=John/Jack/Jonas which should give me all items where Name equals John, Jack or Jonas. Is this even possible?

Dynamic Javascript in Ajax Partial View

I have a partial view which uses Ajax.ActionLink to perform paging.  The AjaxOptions in the link identify the update target (a div on the main view) and some javascript to run OnSuccess (in the partial view).  The javascript must be in the partial view since there is some information in the partial view required to properly wire up the jQuery in the javascript.  This isn't working as expected.  The sample below is the minimum code to duplicate the behavior I am seeing: Controller: private static int count; // // GET: /Home/ public ActionResult Index() { ViewData["Test"] = count++; return View(); } [HttpPost] public ActionResult TestPartial() { ViewData["Test"] = count++; return PartialView(); } View:  <%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Index</title> <script src="../../Scripts/MicrosoftAjax.js" type="text/javascript"></script> <script

"view state" does't work for Image's ImageURL in dynamic controls


Hi all. in my page_load method I call a mthod that it create some dynamic controls. one of them is an Image control that it's ImageURL property set to an URL that is saved in data base. image shows that URL but when postback ocuurs, previous image controls doesn't their image. but other controls for example TextBoxes keep text values. what should I do for keep image url property for this dynamic Images controls?


Can a Dynamic Data page update a View?



I just started working with Dynamic Data (asp.net 4, VS 2010 express, C#) and have tried to simplify the displaying/not displaying of columns by using a simple, single table, updatable SQL view.  Adding and displaying the view work and the in-line edit and update controls are there and seem functional but I can't access any of the columns.

Does DD not support updatable views or have I missed something?


Based on the rowsize entered on the text box, how to generate a dynamic grid view of that many row?


Hi, I have a text box.It is having 2 validation on it(Range validator and req field validator). Now,if I enter an integer within 0-8,just after gettting out of focus of the text box,I need to generate a grid which should contain exactly that many number of rows. Now,My question is: 1.How to capture that number entered in the text box and without any button click event,how to to generate the grid?I suppose,I need to write the code in one of the TextBox event.But,which one and how? Please help me as I am in urgent need.

Dynamic Sql depending on parameter values



I have only just started to use Reporting Servcies and would like to know is there any way of putting IF statments into the SQL statment depending on the value of a selected parameter.

="select  code, cid, name + '(' + code + ')' as ShopName, qty, val, salesdate  from shops" & 
" inner join sal_sumdaily on code = shopcode inner join calendar on salesdate between weekstart and weekend" &
" where trading = 0 and shopclosed = 0 and cid = " & Parameters!RP_CID.Value & "" &
" and l4l = " & Parameters!RP_L4L.Value & "" &
" and newarea = " & Parameters!RP_Area.Value & "" &
" order by code"

What I would like to do is when "Parameter!RP_Area.value" = 99 then miss that part of the sql statment out, something like this.

="select  code, cid, name + '(' + code + ')' as ShopName, qty, val, salesdate  from shops" & 
" inner join sal_sumdaily on code = shopcode inner join calendar on salesdate between weekstart and weekend" &
" where trading = 0 and shopclosed = 0 and cid = " & Parameters!RP_CID.Value & "" &
" and l4l = " & Parameters!

Adding dynamic watermark to SharePoint 2010 document when open? (on browser view)


hi all,

In Sharepoint 2010, how to adding dynamic watermark to word 2010 when opening?

I thinking,

may be just need configure in sharepoint 2010?

or need sharepoint develop?


What you guys think? Any thoughts are welcome!

Thank you!


Dynamic columns for View at runtime


I finally got the DynamicLibrary issue nailed down I asked about in another post. The basic gist is that there's a project table that renders to a View. The user can, at runtime, choose the columns to display and the order in which they should be displayed. Here's the method that does the work:

public IQueryable<s_Project> GetFilteredProjects(List<string> columns, string orderBy)
    string sql = string.Empty;

    // First option is that columns were specified and an orderBy was included.
    if(columns.Count > 0 && !string.IsNullOrWhiteSpace(orderBy))
        sql = "select " + columns.SerializeToCsv() + " from s_Projects order by " + orderBy;
    // Second option is that columns were specified by no orderBy was included.
    else if (columns.Count > 0 && string.IsNullOrWhiteSpace(orderBy))
        sql = "select " + columns.SerializeToCsv() + " from s_Projects order by Name";
    // Third option is that no columns were specified but an orderBy was included.
    else if (columns.Count == 0 && !string.IsNullOrWhiteSpace(orderBy))
        sql = "select * from s_Projects order by " + orderBy;
    // Fourth option is that no columns or orderBy was included.
        sql = "select * from s_Projects order by Name";


Combining view-only data and Dynamic Data on insert/edit pages


Hello all, here's a problem I've been trying to figure out an elegant solution for, but so far I'm coming up blank. I have a situation where I'd like to display view-only data and Dynamic Data together on the same page (without creating custom insert.aspx and edit.aspx pages). I've been playing around with using a SQL view, so that it returns me both my view-only fields and my updateable fields as well. I'm having issues with the insert side of things, the edit page works quite well, and I know I'm going to have to create custom delete logic. The major drawback to using a SQL view though is that to get it to behave you have to 'hack' the .edmx file, and I'm not sure I want to do that. So I guess what I'm asking is that has anyone had any success with this, or should I just bite the bullet and create custom pages for the situation of having view-only data and Dynamic Data on the same page? For the record I'm using the Release Candidate version of VS, and my website is an "ASP.NET Dynamic Entities Web Site". Thanks!

Problem in displaying values for foreign keys in Dynamic data asp.net web app


I have the following tables in my database which are as given under:


Table 2: CREATE TABLE [dbo].[PromotionCodes]( [PromotionCode] nchar NOT NULL, [CustomerPromotionDiscountID] [int] NOT NULL, [EmployeePromotionDiscountID] [int] NOT NULL, [IsActive] [bit] NOT NULL, CONSTRAINT [PK_PromotionCodes_1] PRIMARY KEY CLUSTERED ( [PromotionCode] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY]

There is a foreign key relationship between columns (1) PromotionID of table PromotionDiscountValues and CustomerPromotionDiscountID of table PromotionCodes and (2) PromotionID of table PromotionDiscountValues and EmployeePromotionDiscountID of table PromotionCodes

When i browse the PromotionCodes table in the dynamic data listing, the following columns get displayed:

  1. PromotionCode

  2. IsActive

  3. Prom

Dynamic ComboBoxes / SelectedItem is initially set to null by the view?



I'm having a problem with the ComboBox.SelectedItem being set to null when the application starts, and that clears my view-model property. It seems to load the view-model's selected item correctly at design-time though. Here's the XAML:

       <ItemsControl ItemsSource="{Binding TeamList}">
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="{Binding Name}" VerticalAlignment="Center" />
                        <ComboBox DisplayMemberPath="Name" ItemsSource="{Binding TeamMemberList}"

Is there a VB.Net equivalent to the "" attribute of a C# based view?


Is there a VB.Net equivalent to the "<dynamic>" attribute of a C# based view?


<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend