Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. need help to pass runtime values to a custom user control

need help to pass runtime values to a custom user control

Scheduled Pinned Locked Moved ASP.NET
help
8 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    User 1319852
    wrote on last edited by
    #1

    Hi all, I created a custom user contols which accepts some parameters and fetches records to a datagrid and display it. The problem is: Now i need to pass a dynamic variable say I need to pass it like this; But this doesn't work and it says invalid syntax near "<". I replaced this with < still I couldn't get the solution "<%=dData%>" :: for this it says incorrect syntax near "<" Please help... Thanks in advance,

    Z 1 Reply Last reply
    0
    • U User 1319852

      Hi all, I created a custom user contols which accepts some parameters and fetches records to a datagrid and display it. The problem is: Now i need to pass a dynamic variable say I need to pass it like this; But this doesn't work and it says invalid syntax near "<". I replaced this with < still I couldn't get the solution "<%=dData%>" :: for this it says incorrect syntax near "<" Please help... Thanks in advance,

      Z Offline
      Z Offline
      ZimCoder
      wrote on last edited by
      #2

      Can you post your code please ::zimcoder:: Brainbench Certified ASP.NET developer What Democracy?? Jesus Christ is King and if you do not like it... well you can go to hell!

      U 2 Replies Last reply
      0
      • Z ZimCoder

        Can you post your code please ::zimcoder:: Brainbench Certified ASP.NET developer What Democracy?? Jesus Christ is King and if you do not like it... well you can go to hell!

        U Offline
        U Offline
        User 1319852
        wrote on last edited by
        #3

        Hi, I'm copying the relevant code since that code is too large to copy here.. in code behind I'm getting that error. codebehind in Web user control (.cs file) extending : WebControl string strSelect = SQLQ.ToString(); DA = new SqlDataAdapter(strSelect,theConnection); DS = new DataSet(); DA.Fill(DS); DGGen.DataSource = DS; DGGen.DataBind(); HTML side ------------------------------------------------------------------------------ <%@ Page language="c#" Codebehind="Category.aspx.cs" AutoEventWireup="false" Inherits="Products.Category" %> <%@ Register TagPrefix="GTS" NameSpace="Products.Controls" Assembly="Products" %> ListCategory

        ---------------------------------------------- hope this code help u to understand my problem.. here I want to transfer the ID through CgID (as a runtime value), But it is not working sharath

        U 1 Reply Last reply
        0
        • U User 1319852

          Hi, I'm copying the relevant code since that code is too large to copy here.. in code behind I'm getting that error. codebehind in Web user control (.cs file) extending : WebControl string strSelect = SQLQ.ToString(); DA = new SqlDataAdapter(strSelect,theConnection); DS = new DataSet(); DA.Fill(DS); DGGen.DataSource = DS; DGGen.DataBind(); HTML side ------------------------------------------------------------------------------ <%@ Page language="c#" Codebehind="Category.aspx.cs" AutoEventWireup="false" Inherits="Products.Category" %> <%@ Register TagPrefix="GTS" NameSpace="Products.Controls" Assembly="Products" %> ListCategory

          ---------------------------------------------- hope this code help u to understand my problem.. here I want to transfer the ID through CgID (as a runtime value), But it is not working sharath

          U Offline
          U Offline
          User 1319852
          wrote on last edited by
          #4

          this one is missed.. between those TR's techqrys@rediffmail.com wrote: "" ""

          1 Reply Last reply
          0
          • Z ZimCoder

            Can you post your code please ::zimcoder:: Brainbench Certified ASP.NET developer What Democracy?? Jesus Christ is King and if you do not like it... well you can go to hell!

            U Offline
            U Offline
            User 1319852
            wrote on last edited by
            #5

            oops.. these tags are getting swallowed.... <GTS:ADMINDATATABLES id="adminDG" SQLQ="slect * from tbl_products where categoryid=<%=CgID%>" runat="server" HLURL="EditLessons.aspx?QryId={0}" UniqId="LessonID" HLText="Edit" Edit="True" RperP="5"></GTS:ADMINDATATABLES>

            Z 1 Reply Last reply
            0
            • U User 1319852

              oops.. these tags are getting swallowed.... <GTS:ADMINDATATABLES id="adminDG" SQLQ="slect * from tbl_products where categoryid=<%=CgID%>" runat="server" HLURL="EditLessons.aspx?QryId={0}" UniqId="LessonID" HLText="Edit" Edit="True" RperP="5"></GTS:ADMINDATATABLES>

              Z Offline
              Z Offline
              ZimCoder
              wrote on last edited by
              #6

              techqrys@rediffmail.com wrote: SQLQ="slect * from tbl_products where categoryid=<%=CgID%>" it would seem to me that the above query is not correct. you are not properly concatenating "slect * from tbl_products where categoryid= to the dynamic value <%=CgID%> try putting single quotes here '<%=CgID%>' Goodluck zimcoder What Democracy?? Jesus Christ is King and if you do not like it... well you can go to hell!

              U 1 Reply Last reply
              0
              • Z ZimCoder

                techqrys@rediffmail.com wrote: SQLQ="slect * from tbl_products where categoryid=<%=CgID%>" it would seem to me that the above query is not correct. you are not properly concatenating "slect * from tbl_products where categoryid= to the dynamic value <%=CgID%> try putting single quotes here '<%=CgID%>' Goodluck zimcoder What Democracy?? Jesus Christ is King and if you do not like it... well you can go to hell!

                U Offline
                U Offline
                User 1319852
                wrote on last edited by
                #7

                Hi zimcoder, I thank you for all the help u r doing, I tried with <%=CgId%> or <%#CgId%> or <%; Response.Write(CgId); %> with single quote as you said, But that didn't worked for me. and the query I typed here is wrong. But I gave that right in my code. If I take out that tag and hardcode to some value say 1 or 2 it works very fine for me. I'm stuck in here for a long time. Please help. Thank you, Sharath.

                Z 1 Reply Last reply
                0
                • U User 1319852

                  Hi zimcoder, I thank you for all the help u r doing, I tried with <%=CgId%> or <%#CgId%> or <%; Response.Write(CgId); %> with single quote as you said, But that didn't worked for me. and the query I typed here is wrong. But I gave that right in my code. If I take out that tag and hardcode to some value say 1 or 2 it works very fine for me. I'm stuck in here for a long time. Please help. Thank you, Sharath.

                  Z Offline
                  Z Offline
                  ZimCoder
                  wrote on last edited by
                  #8

                  Hi Can you zip your code and upload it. I will run it on my machine and see where the problem is zimcoder What Democracy?? Jesus Christ is King and if you do not like it... well you can go to hell!

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups