Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11508

Can't pass variable between ImageButton and c# Function

$
0
0

Hi,

I have the following code but for some (probably obvious) reason the value doesn't get entered into my list. If I replace additem[Title] = with manual text the list will update.

ImageButton lnk = new ImageButton();
                   //lnk.ID = title;
                   lnk.Command += send_Click;
                   lnk.CommandArgument = title;
        protected void send_Click(object sender, CommandEventArgs e)
        {
            SPWeb site = SPContext.Current.Web;
              var clicklist = site.Lists["ListName"];
              string WPTitle = e.CommandArgument.ToString();
                SPListItem additem =  ListName.AddItem();
                additem["Title"] = WPTitle;
                additem.Update();

Any help as to how to pass this variable to the c# function without using Javascript?

Thanks


Viewing all articles
Browse latest Browse all 11508

Trending Articles